Skip to content
Advertisement

Unable to add watermark image in existing PDF

I am using TCPDF to add an image watermark to my existing pdf. Only a few of the pdf files are loading the watermark properly (2nd image) and some of them do not support a watermark image (1st image). Also, I want to remove the watermark from the last page of the generated pdf. I am sharing a pdf sample without a watermark.

Following the code, used to create a watermark image to exiting pdf. I have created a library to add a header() and footer(). Why is it working fine in some PDF and others not?

JavaScript

1.Sample.pdf which is not loading watermark inside pdf enter image description here

2.sample2.pdf with watermark. enter image description here

Advertisement

Answer

I have created a library which define all header() , footer() function. I have made changes in the library file.I have remove all watermark generation code from library and call it where the actual PDF is generation function and my error was solved

// initiate PDF library

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement