I am trying to programmatically create a number of PDF documents with a watermark on each page using itextsharp (a C# port of Java’s itext).
I am able to do this after the document has been created using a PdfStamper. However this seems to involve re-opening the document reading it and then creating a new document with the watermark on each page.
Is there a way of doing this during document creation?
After digging into it I found the best way was to add the watermark to each page as it was created. To do this I created a new class and implemented the IPdfPageEvent interface as follows:
This object is registered to handle the events as follows: