Add PDF Page Stamps in PDF using C#
Add Page Stamp with C#
A PdfPageStamp can be used when you need to apply a composite stamp containing graphics, text, tables. The following example shows how to use a stamp to create stationery like in using Adobe InDesign, Illustrator, Microsoft Word. Assume we have some input document and we want apply 2 kinds of border with blue and plum color.
The following code snippet also work with Aspose.PDF.Drawing library.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AddPageStamp()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_StampsWatermarks();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "AddPageStampInput.pdf"))
{
//Create PdfPageStamps
var bluePageStamp = new Aspose.Pdf.PdfPageStamp(dataDir + "AddPageStamp.pdf", 1)
{
Height = 800,
Background = true
};
// Add stamps
document.Pages[1].AddStamp(bluePageStamp);
// Save PDF document
document.Save(dataDir + "AddPageStamp_out.pdf");
}
}