Allow negative struct parent keys in PDFMergerUtility
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.
Do you have a PDF where this happens?
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.