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

menteith85 commented on PDFBOX-5559:
------------------------------------

Tilman, I'm not sure if I follow.

 
{code:java}
if that isn't created with PDFBox then it's not our problem {code}
*file.pdf* wasn't created by PDFBOX, but after being modified by PDFBOX *qpdf* 
complains about it. In other words, *qpdf* doesn't complain about the original 
file. It complains about the file after modifications have been made by PDFBOX. 
Those modifications concern only replacing PDActionJavaScript with 
PDActionGoTo. Is this an issue with PDFBOX?
 
As for the original issue (sample.pdf, sample_modified.pdf), thanks for the 
explanation. The error was clearly on my side. I wanted to create sample pdf 
since I didn't want to share copyrighted file. Many sorry for this.
 

> QPDF prints warnings about a PDF modified by PDFBOX 
> ----------------------------------------------------
>
>                 Key: PDFBOX-5559
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5559
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.27
>            Reporter: menteith85
>            Priority: Minor
>         Attachments: sample.pdf, sample_modified.pdf, screenshot-1.png
>
>
> Hi!
> I created a sample PDF file with PDAnnotationLink using PDFBox. Then I 
> changed action from PDActionURI to PDActionGoTo. The modified pdf is 
> correctly working in Okular (a pdf viewer for Linux) but *qpdf* (version 
> 11.2.0) emits the following warning:
> {code:java}
> ❯ qpdf --linearize --replace-input sample_modified.pdf 
> WARNING: sample_modified.pdf, object 2 0 at offset 88: kid 1 (from 0) appears 
> more than once in the pages tree; creating a new page object as a copy 
> qpdf: there are warnings; original file kept in 
> sample_modified.pdf.~qpdf-orig 
> qpdf: operation succeeded with warnings; resulting file may have some 
> problems{code}
> Please find below the code I used to modify pdf. I can also provide code to 
> create that pdf if needed.
> {code:java}
> final PDPage page = doc.getPage(0);
> final PDPageXYZDestination destination = new PDPageXYZDestination();
> destination.setPage(page);
> final PDActionGoTo action = new PDActionGoTo();
> action.setDestination(destination);
> final PDAnnotationLink annotationLink = new PDAnnotationLink();
> annotationLink.setAction(action);
> float X_MARGIN_LEFT = 50F;
> float BOX_WIDTH = 240F;
> float TEXT_LINE_HEIGHT = 14F;
> final PDRectangle position = new PDRectangle();
> final int x = 120;
> final int y = 120;
> position.setLowerLeftX(x);
> position.setLowerLeftY(y);
> position.setUpperRightX(X_MARGIN_LEFT + BOX_WIDTH);
> position.setUpperRightY(y + TEXT_LINE_HEIGHT);
> annotationLink.setRectangle(position);
> page.setAnnotations(List.of(annotationLink));
> doc.save("sample_modified.pdf");{code}
>  
> *qpdf* complains also about a different pdf (copyrighted) modified in similar 
> way. The warning reads:
> {code:java}
> WARNING: file.pdf: reported number of objects (12991) is not one plus the 
> highest object number (12989){code}



--
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