[ 
https://issues.apache.org/jira/browse/PDFBOX-6277?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18125522#comment-18125522
 ] 

ASF subversion and git services commented on PDFBOX-6277:
---------------------------------------------------------

Commit 1938950 from Tilman Hausherr in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1938950 ]

PDFBOX-6277: force decimal, add test

> 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: 2.0.37, 3.0.8 PDFBox
>            Reporter: Karol Bryd
>            Assignee: Tilman Hausherr
>            Priority: Major
>             Fix For: 2.0.38, 3.0.9 PDFBox, 4.0.0
>
>         Attachments: PageLabelsMergeRepro.java, labels.pdf, nolabels.pdf, 
> result.pdf
>
>
> 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]

Reply via email to