Works for me. Are you sure no exception is thrown even in close()?

Best Regards,
Paulo Soares

----- Original Message ----- 
From: "Peter Zhou" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 16, 2002 7:33
Subject: [iText-questions] Open PDF-file error: it has no pages


> Hi iText developers,
>  
> I try to open the generated PDF file with Acrobat 5.0, but it fails. The
> Acrobat 5.0 gives the following error message:
>              there was an error opening this document. This file cannot
> be opened because it has no pages
>  
> Here is the code to generate the PDF file:
>  
> // step 1: creation of a document-object
>         Document document = new Document(PageSize.A4, 50, 50, 50, 50);
>         try {
>             // step 2:
>             // we create a writer that listens to the document
>             PdfWriter writer = PdfWriter.getInstance(document, new
> FileOutputStream("Chap1110.pdf"));
>             // step 3: we open the document
>             document.open();
>             // step 4:
>             // we add some content
>             for (int k = 1; k <= 10; ++k) {
>                 document.add(new Paragraph("This document has the
> logical page numbers: i,ii,iii,iv,1,2,3,A-8,A-9,A-10\nReal page " + k));
>                 document.newPage();
>             }
>             PdfPageLabels pageLabels = new PdfPageLabels();
>             pageLabels.addPageLabel(1,
> PdfPageLabels.LOWERCASE_ROMAN_NUMERALS);
>             pageLabels.addPageLabel(5,
> PdfPageLabels.DECIMAL_ARABIC_NUMERALS);
>             pageLabels.addPageLabel(8,
> PdfPageLabels.DECIMAL_ARABIC_NUMERALS, "A-", 8);
>             writer.setPageLabels(pageLabels);
>         }
>         catch (Exception de) {
>             de.printStackTrace();
>         }
>         
>         // step 5: we close the document
>         document.close();
>  
>  
>  
> Thanks in advance
> Peter



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to