djf23
djf23

Reputation: 21

Adobe Sdk programmatically removing watermarks

I'm using Adobe PDF library (C++ Interface) and have been trying to remove the watermarks on an existing PDF for a while.

To add a watermark I have used the PDDocAddWatermarkFromText method, but I would need to remove the previously existing watermarks on the file.

I accomplished the task when the Watermark is added as an Annotation, but this will not cover all the possible cases, as it seems they can be added also as background Objects. Would need to know how these background objects can be removed from the file.

Thanks for help!

Upvotes: 2

Views: 407

Answers (2)

Patrick Gallot
Patrick Gallot

Reputation: 625

Watermarks will typically be the last element of the page's content stream, Backgrounds will the first element of the content stream. So I would check if the first or last element is a PDEForm. And if it is, I would then check if the PDEFormCosObj has a PieceInfo dictionary entry. The PieceInfo dictionary may indicate if it is a WaterMark or a Background.

Otherwise, you might need to analyze the content of that PDEForm for watermark-like properties (e.g. is it a Text Element with a single textRun? Does the Form|Text|TextRun's matrix indicate any rotation?)

Upvotes: 0

JosephA
JosephA

Reputation: 1215

Well, it may prove difficult to clearly identify Watermarks that exist as purely text for removal instead of for example existing as a Watermark annotation. That being said if you can identify a pattern to how the watermarks are formatted it may be possible to devise a solution.

Have you attempted to contact the Support department for more assistance?

Upvotes: 0

Related Questions