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

Reply via email to