Hi
I am struggling to import pdf pages.
I am generating a document using a PdfWriter. At the end of the document I
want to append some pages from another pdf file.
I tried using PdfCopy which uses the same document and outputstream as the
document I am writing to. Maybe this is incorrect?
PdfCopy copy = new PdfCopy(doc, os);
PdfReader reader = new PdfReader(importFileName);
when I get the first page
copy.getImportedPage(reader, 1);
I get a null pointer exception:
java.lang.NullPointerException
at
com.lowagie.text.pdf.PdfWriter.getPdfIndirectReference(PdfWriter.java:1584)
at
com.lowagie.text.pdf.PdfImportedPage.<init>(PdfImportedPage.java:68)
at
com.lowagie.text.pdf.PdfReaderInstance.getImportedPage(PdfReaderInstance.jav
a:93)
at com.lowagie.text.pdf.PdfCopy.getImportedPage(PdfCopy.java:162)
I then tried opening the output document with a PdfCopy but could not add
content (I think the PdfCopy class does not allow this).
I then tried using PdfStamper
PdfStamper stamper = new PdfStamper(reader, os);
stamper.getImportedPage(reader, 1);
but this does not copy the first page of the reader into the output
document.
Any help would be much apprecaiated.
James
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions