We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Adding water mark to PDF using aspose.pdf lib APIs

Dear support,


I am trying to add water mark in pdf using Aspose.pdf lib aspose-pdf-10.6.2-java.

In one of the page of pdf water mark does not appear, in other page it comes.
As, I guess, there is pdf page elements that do not have transparent background. Hence, hiding watermark appearing in background.

Please help me out as many of my customer has enquired for this. Also, it is affecting features reliability.

I have attached original pdf and formatted pdf

Hi there,


Thanks for your inquiry. Please note usually it happens due to opaque background of PDF document. Please set Background property of watermark/stamp to false. It will comes to front and hopefully it will resolve your issue. If the issue still persist then please share your sample code here as well. So we will look into it further and provide you information accordingly.

…<o:p></o:p>

....

//create text stamp

com.aspose.pdf.TextStamp textStamp = new com.aspose.pdf.TextStamp("Sample Stamp");

//set whether stamp is background

textStamp.setBackground(false);

....

....


Please feel free to contact us for any further assistance.

Best Regards,
Dear Team,

I agree with your solution that it will work, but we have configurable font size. If font size increases, there is more chances of hiding text behind water mark.

Do we have some way to get text elements around water mark to make it transparent. So, water mark will appear without any issue under text.

Hi there,


Thanks for your feedback. Yes you can set opacity property of TextStamp to control the transparency. Hopefully it will help you to accomplish the task.

//create text stamp<o:p></o:p>

com.aspose.pdf.TextStamp textStamp = new com.aspose.pdf.TextStamp("Sample Stamp");

//set whether stamp is background

textStamp.setBackground(false);

textStamp.setOpacity(.5);

...

...


Please feel free to contact us for any further assistance.

Best Regards,