Karol Bryd created PDFBOX-6277:
----------------------------------
Summary: PDFMergerUtility writes /PageLabels without an entry for
page index 0
Key: PDFBOX-6277
URL: https://issues.apache.org/jira/browse/PDFBOX-6277
Project: PDFBox
Issue Type: Bug
Components: PDModel
Affects Versions: 3.0.8 PDFBox, 2.0.37
Reporter: Karol Bryd
Attachments: PageLabelsMergeRepro.java
Hello,
I think I hit a bug in PDFBox related to merging documents with
PDFMergerUtility.appendDocument and the way how it handles Page Labels. I
verified that with the PDF spec and looks like it is a real problem, although I
am not a PDF expert, so please verify.
The problem can be reproduced by merging 2 files, when the first file has no
/PageLabels and a later one has them PDFMergerUtility copies the labels shifted
by the page count of the preceding documents, but never adds an entry for index
0, For example, when merging a 2 page unlabelled PDF with a 1-page PDF labelled
/Nums [0 <</S /D>>] gives /PageLabels << /Nums [2 ...] >>
I found in PDF spec documen, section 12.4.2 Table 28 this: *The tree shall
include a value for page index 0"* and I actually stumbled upon this by
processing documents merged with PDFBox with a tool based on PyMuPDF which
raises an error: {color:#000000}IndexError: list index out of range{color}
{color:#000000} {color}
I tested other PDF libraries: aspose-pdf, pdfnet and pdfbox itself and they
tolerate such files, but they report page labels differently and in an
inconsistent way. Only PyMuPDF rejectes them.
Attached Java class reproduces the problem.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]