Is there a way to use iTextSharp to put a watermark on a .pdf document such that the watermark is only visible when printed and is not visible when viewing the document?
-
http://stackoverflow.com/questions/2022972/pdf-watermark-for-printing-only-programatically – Robert Harvey May 17 '13 at 19:34
1 Answers
There are two possible solutions:
Solution 1: use an OCG layer. OCG stands for Optional Content Groups. It means that you can add content that is optional. Take a look at this example: layer_structure.pdf
It contains some text that is shown on the screen "PRINT THIS PAGE". If you print the document, this text won't be visible. You need the exact opposite, but that's only a matter of changing the settings of the OCG to which the text belongs. See OptionalContentExample for the source code. Go to the C# port if you don't understand Java.
Solution 2: Use an annotation and set the visibility of the annotation in such a way that it's not shown on screen, only when printed.
Note that this question is a duplicate of PDF Watermark for printing only, programatically

- 1
- 1

- 75,994
- 9
- 109
- 165