On 9/9/2013 8:13 PM, tech rek wrote:
Can I watermark single pages in a merge operation
with iText Java?
Did you read the documentation?
For instance: http://manning.com/lowagie2/samplechapter6.pdf
. I have a requirement to open
each image in memory and watermark them
What do you mean by Image?
save them after they are merged. is it doable?
There's more than one way to do it, but the workflow you suggest is
One could watermark PDFs in memory with PdfStamper and then merge
them with PdfSmartCopy.
That's similar to what is done in listing 6.24 where a stamper
writes to a ByteArrayOutputStream of which the bytes are used to add
a page to a PdfCopy object (listing 6.25 uses a PdfSmartCopy object
to reduce the file size).
One could merge the PDFs with PdfCopy, and then add the watermark in
a second pass.
That's similar to what is done in listing 6.14 where PdfStamper is
used to add a header and a footer. A watermark isn't that different;
as a matter of fact listing 6.15 is about adding a background to an
One could merge and stamp in one go as shown in listing 6.22.
Nobody but you can tell you what the best solution is in your case,
because only you know the exact requirement. Please read the
documentation carefully and you'll have all the arguments you need
to make the best decision.