Page order

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for Java (v7)  /  Page order

DynamicPDF Generator for Java (v7) Forum

 Sep 16 2015 1:22 PM
Whenever I add a new page to my Document object through Document.getPages().add(page), the new page becomes page 1, while the original page becomes page 2.

Is there a way to make this so that the original page remains page 1 while additional pages are added to the end?
 Sep 16 2015 4:40 PM
Posted by a ceTe Software moderator
Hello,

When you use Document.getPages().add(page) it will add the page at the end of the existing pages and not at the beginning. We have tested the following code with the latest build of Generator v7 and it is working as expected. Please try the latest build and see if it resolves the issue.

          Document document = new Document();

          // Create a Page and add it to the document
          Page page = new Page();
          document.getPages().add(page);

          // Add a label to the page
          page.getElements().add(new Label("Page 1", 0,0, 512, 40, Font.getHelvetica(), 30, TextAlign.CENTER));
          
          Page page2 = new Page();
          document.getPages().add(page2);

          // Add a label to the page
          page2.getElements().add(new Label("Page 2", 0,0, 512, 40, Font.getHelvetica(), 30, TextAlign.CENTER));
    
          // Save the PDF document
         document.draw("MyDocument.pdf");


In case the latest build does not resolve the problem, please email the following to support@cete.com so we can look into it further.

1. Code used to create the PDF. 
2. Input PDFs (if any used)
3. Output PDF

Thanks,
ceTe Software Support Team.



All times are US Eastern Standard time. The time now is 1:40 AM.