iTextsharp add large water mark over the pdf

Hey friends, Today I’m going to let you guys know how to add a big water mark on the pdf. So some case when we generate pdf we need a add large water mark. For example : we have invoice pdf and we need to mark it as a paid by large water mark. How can we achieve this using 4-5 line code in itextsharp.

Please have a look over the code. It will allow you to add large watermark over the pdf.

 doc.Open();  		  
 // Specify font and alignment of text watermark
 var font = new Font(Font.FontFamily.HELVETICA, 60, Font.NORMAL, BaseColor.LIGHT_GRAY);
            ColumnText.ShowTextAligned(pdfWriter.DirectContent, Element.ALIGN_CENTER, new Phrase("PAID", font), 300, 400, 45);

itextsharp_watermark_pdf

If you will see above code put once doc.Open();

It don’t need any image just test will work fine.

Don’t forgot to comment and share.

Posted by | View Post | View Group