Stupi / flying-saucer

Automatically exported from code.google.com/p/flying-saucer
0 stars 0 forks source link

counter(pages) is not working correctly with writeNextDocument() #205

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Prepare 5 well formatted XHTML files. Each file contains only one line and 
has a footer with Page X of Y, where X/Y are defined in CSS as:

#pagenumber:before {
    content: counter(page); 
}

#pagecount:before {
    content: counter(pages);  
}

2. Generate a PDF using those 5 files with the following code:
                        Iterator<File> files = tempXHTMLs.iterator();
            renderer.setDocument(files.next());
            renderer.layout();
            renderer.createPDF(os, false);

            while (files.hasNext()) {
                renderer.setDocument(files.next());
                renderer.layout();
                renderer.writeNextDocument(renderer.getWriter().getCurrentPageNumber() + 1);
            }

3. The PDF was generated but pages counter is NOT correct.

Expected Output: 5 Pages in PDF with footer in correct sequential as: Page 1 of 
5, Page 2 of 5, ..., Page 5 of 5

Acctual Output: Wrong total pages counter, which is: Page 1 of 1, Page 2 of 2, 
..., Page 5 of 5.

I tried on both R8 and R9.0.1. Same.

Original issue reported on code.google.com by bingh...@gmail.com on 9 Aug 2012 at 8:33