Qt API: Document::page(const QString &label) not working in some documents
When using the Qt 5/6 API of poppler, for some documents pages cannot be found by their label. Given an affected PDF document this means that for any Poppler::Page* page in the document:
document->page(page->label()) == NULL
although the pages do have valid labels.
A code snipplet to test this issue and two test documents (one which shows the bug and one which doesn't) are attached: poppler_pagelabels.tar.gz
The problem is found in the qt5 and qt6 API of poppler 21.10.0, but also in older versions at least since 21.07.0.
This might be related to the way how page labels are defined in the PDF. In the attached baddocment.pdf
all page labels are defined entirely via the prefix (/P
) of the page label and the page label object does not include a numbering style (/S
).