Page positions, page labels, a... Note

Page positions, page labels, and printed numbers are different PDF data

PDF subsets can have correct content but misleading page labels, even when page count and text extraction checks pass. This occurs because three distinct values can be associated with a page: its position in the document, its logical label (e.g., 'i', '1'), and its printed number on the page itself. In a specific test case, a three-page PDF extracted from a six-page source showed correct content but inherited logical labels from the beginning of the original document instead of retaining the labels of the selected source pages. The original source had labels 'COVER', 'i', '1', '2', 'A-1', 'A-2', and the selected pages were at source positions 3, 4, and 6. The downloaded PDF, however, displayed labels 'COVER', 'i', and '1' for output pages 1, 2, and 3 respectively, instead of the expected '1', '2', and 'A-2'. This discrepancy highlights that simply extracting pages does not automatically remap or preserve original logical labels or printed numbers. A python script, 'audit-labels.py', was developed to check if a subset PDF's labels match the labels of its corresponding source pages, based on a preservation policy. The script confirmed the label mismatch in the test case. It is crucial to define the desired label policy for extracted PDF subsets, whether to preserve source labels or generate new ones. This checker focuses only on label preservation and does not validate rendering, bookmarks, or other PDF features.