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.Exceptio
' 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);
//...build the document
Watermark watermark = new Watermark(new Jpeg("watermark.jpg"), 0, 0);
document.watermark = watermark;