|
I tried these lines to import the original PDF file
to the PdfWriter.
public static void main(String[] args) { try { PdfReader pdf_file = new PdfReader("Demo1.pdf"); Document document = new Document(); FileOutputStream file_result = new FileOutputStream("result.pdf"); PdfWriter writer = PdfWriter.getInstance(document, file_result); document.open(); document.newPage(); writer.open(); PdfImportedPage import_page = writer.getImportedPage(pdf_file, 1); //document.close(); //writer.close(); } catch(Exception e) { e.printStackTrace(); } But seems that I
cannot close both the 'writer' and the 'document'. It is always trapped to this
exception if I do close the writer or document or both
ExceptionConverter: java.io.IOException: The
document has no pages.
at com.lowagie.text.pdf.PdfPages.writePageTree(Unknown Source) at com.lowagie.text.pdf.PdfWriter.close(Unknown Source) at com.lowagie.text.pdf.PdfDocument.close(Unknown Source) at com.lowagie.text.Document.close(Unknown Source) at InsertFields.main(InsertFields.java:61) I'm sorry bout this, actually I'm really new in
Java Programming.
Any suggestion will be good for me.
Thanks.
Nicholas Sutanto
|
- [iText-questions] Inserting Field in existing PDF file Nicholas Sutanto
- RE: [iText-questions] Inserting Field in existing PD... Paulo Soares
- Re: [iText-questions] Inserting Field in existin... Nicholas Sutanto
- Re: [iText-questions] Inserting Field in exi... Paulo Soares
- Re: [iText-questions] Inserting Field in... Nicholas Sutanto
