Srimathi Herath (Srimathi)
ASG Group
Pega Consultant
ASG Group
Srimathi Member since 2010 5 posts
ASG Group
Posted: February 20, 2019
Last activity: February 20, 2019
Posted: 20 Feb 2019 2:07 EST
Last activity: 20 Feb 2019 2:07 EST

Add Watermark in PDF


  • CSS - We can add the watermark image as background image using CSS code. (PDF generated via correspondence rule)

background-image: url("webwb/Watermark.png" );

background-repeat: no-repeat;

background-position: top;

background-size: 100%;

Known issues- When multiple pages are available in the PDF watermark does not display properly. Solution :- we can create small image and can add watermark using background-repeat:repeat-x;

  • PEGA
    • "AddWatermarkToPdfAttachment" – Activity would help achieve adding water mark on Pega 7.3.1
    • However to view this activity, we need to import PDFutils.zip – which we can download online.


  • Java ITEXT :-

Initially using java Itext code (attached the code) able to add watermark to each page in pdf without any issue however due to licence issue(https://www.lowagie.com/iText) could not integrate the code in Pega.


import java.io.FileOutputStream;

import java.io.IOException;

import com.lowagie.text.DocumentException;

import com.lowagie.text.Image;

import com.lowagie.text.pdf.PdfContentByte;

import com.lowagie.text.pdf.PdfReader;

import com.lowagie.text.pdf.PdfStamper;

public class AddWatermark {

public static void main(String[] args) throws IOException, DocumentException {

PdfReader reader = new com.lowagie.text.pdf.PdfReader("Test.pdf");

PdfStamper pdfStamper = new PdfStamper(reader,

new FileOutputStream("TestNew.pdf"));

Image image = Image.getInstance("TestStamp.jpg");

for(int i=1; i<= reader.getNumberOfPages(); i++){

PdfContentByte content = pdfStamper.getUnderContent(i);

image.setAbsolutePosition(10, 50);









Data Integration Developer Knowledge Share