Creating a watermark from lower left corner to upper right corner

Hello,

Im looking for ways to manipulate the Watermark feature, either with repeating the watermark on the page, numerous times or by stretching the watermark from the bottom left corner to the top right corner and increasing the size. 



Thank you,

Shane


2 Replies 1 reply marked as answer

GK Gowthamraj Kumar Syncfusion Team August 10, 2021 01:12 PM UTC

Hi Shane, 
 
Thank you for contacting Syncfusion support.

Yes. We can draw the watermark from the bottom left corner to the top right corner and increasing the font size using PDF library. Please find the below code snippet to achieve your requirement.
 
 
//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); 
 
Please find the generated PDF document from below, 
 
Please let us know if you need any further assistance with this. 
 
Regards, 
Gowthamraj K 


Marked as answer

SS Shane Scholl August 10, 2021 11:21 PM UTC

Gowthamraj,

Thank you so much for your help.


Regards,

Shane


Loader.
Up arrow icon