Page and pages#
A page is a simple structure:
Pages are split into two parts in the PDF, a dictionary and a content stream.
Dictnum points to the dictionary.
A page is created and added to the PDF with
You need to register all used Annotations, Faces and Images to the page object in order to get the contents structure correct.
After all pages have been collected, you can re-arrange the pages in the PDF file by changing the Pages slice in the Pages object which the main PDF object has a reference to.
For example you can do something like this:
to swap the first two pages.
pw in this example is the main PDF object.
Writing pages to the PDF#
The PDF backend takes care of writing all the Page objects and the Pages object to the PDF. No user action is required.