troubleshooting Question

Watermark image trouble with lowagie's iText

Avatar of corebiz
corebiz asked on
Java.NET Programming
1 Comment1 Solution2140 ViewsLast Modified:
I'm having trouble trying to add a watermark JPEG image to a PDF that I create using com.lowagie.text.  I am writing a .NET 2 application in C#.

The code attached indicates that I create the document, assign the Watermark using a JPEG image that I read straight from the output folder.  The watermark loads correctly (reflects the correct image dimensions when I debug) and then bombs out on document.Close(), where it throws the error:

Exception of type 'com.lowagie.text.ExceptionConverter' was thrown

Any ideas where I'm going wrong?  I've seen PDFStamper mentioned in places, but I thought the watermark property on Document would be simpler.
Rectangle pageDimension = PageSize.A4;
Document document = new Document(pageDimension, 15, 15, 15, 25);
// the document
Watermark watermark = new Watermark(new Jpeg("watermark.jpg"), 0, 0);
document.watermark = watermark;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros