Hi,
 
We're using iText 1.4.8 to watermark a PDF which is a result of multiple 
conversion & mergin with xDocs package from Cambridge Docs. I'm aware of 
one output document so far that generates the following error when calling 
stamp.close() in the method below:
 
public static void addWatermark (PurchaseOrder po, File pdfFile, File output) 
throws IOException
    {
...
...
FileOutputStream fos = null;
                if(output != null){
                    fos = new FileOutputStream(output);
                }else{
                    fos = new FileOutputStream(pdfFile);
                }
                PdfReader reader = new PdfReader(collectedBytes.get(i));
                PdfStamper stamp = new PdfStamper(reader, fos);
                for (int j = 1; j <= reader.getNumberOfPages(); j++) {
                    addWatermarkInDocument(
                        stamp.getUnderContent(j),
                        locale.Sil("resource.ordering", KEY_WATERMARK, 
po.getOrderID()));
                }
                stamp.setFormFlattening(true);
                stamp.close(); <---
 
Full stack trace
 
 Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* 
Style Definitions */ table.MsoNormalTable{mso-style-name:"Table 
Normal";mso-tstyle-rowband-size:0;mso-tstyle-colband-size:0;mso-style-noshow:yes;mso-style-priority:99;mso-style-qformat:yes;mso-style-parent:"";mso-padding-alt:0in
 5.4pt 0in 
5.4pt;mso-para-margin:0in;mso-para-margin-bottom:.0001pt;mso-pagination:widow-orphan;font-size:11.0pt;font-family:"Calibri","sans-serif";mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:"Times
 New 
Roman";mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:"Times
 New Roman";mso-bidi-theme-font:minor-bidi;}
java.lang.NullPointerException 
 
        at 
com.lowagie.text.pdf.StandardDecryption.finish(StandardDecryption.java:105)
 
        at 
com.lowagie.text.pdf.PdfEncryption.decryptByteArray(PdfEncryption.java:429)
 
        at com.lowagie.text.pdf.PdfReader.getStreamBytesRaw(PdfReader.java:1980)
 
        at com.lowagie.text.pdf.PdfReader.getStreamBytesRaw(PdfReader.java:1996)
 
        at com.lowagie.text.pdf.PRStream.toPdf(PRStream.java:176)
 
        at 
com.lowagie.text.pdf.PdfIndirectObject.writeTo(PdfIndirectObject.java:167)
 
        at com.lowagie.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:370)
 
        at com.lowagie.text.pdf.PdfWriter.addToBody(PdfWriter.java:2053)
 
        at com.lowagie.text.pdf.PdfStamperImp.close(PdfStamperImp.java:225)
 
        at com.lowagie.text.pdf.PdfStamper.close(PdfStamper.java:172)
 
        at 
config.cust.ordering.PurchaseOrderFormatter.addWatermark(PurchaseOrderFormatter.java:332)
        at 
config.cust.ordering.PurchaseOrderFormatter.format(PurchaseOrderFormatter.java:264)
 
I'm not sending the PDF to the mailing list directly because it contains some 
sensible data.
 
Is this perhaps a known issue? 
 
I suspect there might be an illegal construct in the source PDF but the Adobe 
reader has no issue reading the file. Would it be hard to trace the problematic 
construct down?
 
Thanks,
Radek
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to