|
//Load the PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("../../TableFeatures.pdf");
//Set the font
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 50);
foreach (var page in loadedDocument.Pages)
{
//Get the loaded page
PdfLoadedPage loadedPage = page as PdfLoadedPage;
//Create graphics
PdfGraphics graphics = loadedPage.Graphics;
//Draw watermark text
PdfGraphicsState state = graphics.Save();
graphics.SetTransparency(0.25f);
graphics.RotateTransform(-55);
graphics.DrawString("Imported using Essential PDF Syncfusion", font, PdfPens.Red, PdfBrushes.Red, new PointF(-640, 460));
graphics.Restore();
}
//Save and close the document
loadedDocument.Save("../../Watermark.pdf");
loadedDocument.Close(true); |