pdfbox icon indicating copy to clipboard operation
pdfbox copied to clipboard

Allow negative struct parent keys in PDFMergerUtility

Open bernhardf-ro opened this issue 3 years ago • 2 comments

PDFMergerUtility expects structural parent tree keys to be non-negative. However, negative values don't seem to be forbidden by the specification and are accepted by validators. This patch adapts the class to handle negative struct parent keys correctly.

bernhardf-ro avatar Jan 10 '23 11:01 bernhardf-ro

Do you have a PDF where this happens?

THausherr avatar Jan 10 '23 17:01 THausherr

Here is a document to verify the issue. (Sorry, I forgot to add that to the issue in the first place.) merge.pdf It is a valid PDF/UA-1, according to PDF Accessibility Checker 2021. Appending it to itself using PDFMergerUtility results in a document that is not valid PDF/UA. ("Structural parent tree" issue) With the patch applied the merge result is valid PDF/UA-1.

bernhardf-ro avatar Jan 11 '23 14:01 bernhardf-ro