Question: Is it possible tos from a PDF programmatically?I tried using some software but those supports only to DELETE the watermark if they added by those components.But I want to remove the watermark which added by some 3rd party tool!
Answer: There are some situations, if the watermarks are "watermark annotation" or a "stamp annotation" internally, then they can be easily deleted. However what appears as a watermark to a human may actually be just ordinary text and images placed in a layer below/above some other content. PDF does not necessarily identify such watermarks. It would not be possible to delete such watermarks without running the risk of deleting useful content. Based on those cases, VeryPDF developed software PDF Text Replacer Command Line, which can be help you remove text watermark of PDF. It also can help you remove image watermark on PDF files. If you want to remove the watermarks for some reasons, this software is good application. And there is also developer license, by which you can develop some software based on this software. Or use this software from Visual Basic, C, Delphi, C#, HTML and other programing languages. So by this software, you can from existing PDF programmatically. Please check more information about this software on homepage, in the following part, I will show you how to use this software.
- There is also GUI version software available, but it can not help you remove watermark programmatically. When downloading command line version finishes, there will be an zip file. Please extract it to some folder then you can find executable file and help document.
- When you use this software, please refer to software usage and examples.
Step 2. Remove watermarks from a PDF programmatically.
- Here is usage for your reference: pdftr.exe [options] <Input-file> <Output-file>
- When remove watermark from PDF by this software, please run it according to the three situations:
- When the watermark is searchable text, please refer to the following command line template:
pdftr.exe -contentreplace "watermark=> " D:\in.pdf D:\out.pdf
When you input this command line, please input parameter –contentreplace first, then “”. In the “”, please input the watermark content first then blank. At last, please input the full path of the input PDF then output PDF file path. Now let us check the text remove effect from the following snapshot.
2. When watermark can not be removed, please try to use the following command line template.
pdftr.exe -oldtext "Old Text" -newtext " " D:\in.pdf D:\out.pdf
3. When remove watermark of image, please refer to the following command line template.
pdftr.exe -oldtext "Old Text" -image D:\test.png -imgwidth 0 -imgheight 0 D:\in.pdf D:\out.pdf
Please note here, the image should be blank image which has same background color with PDF. Then specify the width and height according the text content.
By this software, you can remove watermark on PDF programmatically. During the using, if you have any question, please contact us as soon as possible.