Customizing the Page Number

PSPDFKit supports the PDF page label feature, which means you can rewrite and change the regular absolute one-based numbering in PDF documents.

This means that a document that usually has the page numbering 1, 2, 3, 4 can be changed to have numbering like Prelude, Table of Contents, 1, 2. Page labels can be numbers, Roman numerals, or even free-text strings.

PSPDFKit fully supports page labels and will show custom labels instead of the default numbering, when available, in all places where page labels are displayed. This includes the Table of Contents view controller, the page position view, and the thumbnail views.

You can configure page labels via Adobe Acrobat by opening the thumbnail view, right-clicking on a page, and choosing the Number Pages… menu entry.

Editing Page Labels in Code

It’s also possible to define and edit page labels in code. PSPDFLabelParser will parse the label definition data from the PDF. Starting with PSPDFKit 4 for iOS, you can create a custom label parser class by using the initWithDocumentProvider:labels: initializer and setting this custom interface to the PSPDFDocumentProvider.