Hello again, now I managed to condense the "bad" PDF I wrote about in the postscriptum of my last email to one small page that still shows the behaviour.
This time, the code to reproduce is a bit longer: PdfReader currentReader = new PdfReader("D:/temp/bug.pdf"); Document document = new Document(PageSize.A4, 0, 0, 0, 0); PdfWriter writer = PdfWriter.getInstance(document, new ByteArrayOutputStream()); document.open(); document.newPage(); List links = currentReader.getLinks(1); PdfAnnotation.PdfImportedLink link = (PdfAnnotation.PdfImportedLink) links.get(0); writer.addAnnotation(link.createAnnotation(writer)); document.close(); This results (when applied to the PDF attached) in the following stack trace: > java.lang.NullPointerException > at > com.lowagie.text.pdf.PdfWriter.getNewObjectNumber(PdfWriter.java:2251) > at > com.lowagie.text.pdf.PRIndirectReference.toPdf(PRIndirectReference.java:98) > at com.lowagie.text.pdf.PdfDictionary.toPdf(PdfDictionary.java:152) > at > com.lowagie.text.pdf.PdfIndirectObject.writeTo(PdfIndirectObject.java:168) > at com.lowagie.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:395) > at com.lowagie.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:375) > at com.lowagie.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:367) > at com.lowagie.text.pdf.PdfWriter.addToBody(PdfWriter.java:792) > at > com.lowagie.text.pdf.internal.PdfAnnotationsImp.rotateAnnotations(PdfAnnotationsImp.java:206) > at com.lowagie.text.pdf.PdfDocument.newPage(PdfDocument.java:940) > at com.lowagie.text.pdf.PdfDocument.close(PdfDocument.java:803) > at com.lowagie.text.Document.close(Document.java:484) This is reproducible both with iText 2.1.5 and with the latest SVN (revision 3863). The stacktrace above is from SVN. By the way, revision 3863 seems to fix my last reported bug in the example document I attached, but not in the original document where I got it reported. It seemed to be much harder to reproduce it now, however. I'll try to build a small new PDF that can reproduce it properly. Regards, Michael
bug.pdf
Description: Adobe PDF document
------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php