Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] How to save PDF after changes?

faisal maqsood

2005-05-20


Hello folks,

Please help, it is urgent.

I've a problem while saving PDF after some changes. I've made a sample, where
I'm using following method to save.

//----------------------------
void savePDF() throws Exception {
  System.out.println("Saving PDF...");
  Document obj_doc = new Document(m_objPDFReader.getPageSize(1));
  FileOutputStream obj_fos = new FileOutputStream(m_strDestPDF);
  PdfWriter obj_pdfWriter = PdfWriter.getInstance(obj_doc, obj_fos);
  obj_doc.open();
  obj_pdfWriter.freeReader(m_objPDFReader);
  obj_doc.close();
  System.out.println("PDF is saved.");
}
//----------------------------

Can anyone write me the right way?

I'm getting following exception:

ExceptionConverter: java.io.IOException: The document has no pages.
at com.lowagie.text.pdf.PdfPages.writePageTree (PdfPages.java:119)
at com.lowagie.text.pdf.PdfWriter.close (PdfWriter.java:1233)
at com.lowagie.text.pdf.PdfDocument.close (PdfDocument.java:941)
at com.lowagie.text.Document.close (Document.java:520)
at ModifyForm.savePDF(ModifyForm.java:24)
at ModifyForm.main(ModifyForm.java:81)

Regards,
Faisal



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
©2008 junlu.com - Jax Systems, LLC, U.S.A.