You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (Jira)" <ji...@apache.org> on 2023/01/26 18:57:00 UTC

[jira] [Comment Edited] (PDFBOX-5561) qpdf shows warnings trying to linearize file modified by PDFBOX

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

Tilman Hausherr edited comment on PDFBOX-5561 at 1/26/23 6:56 PM:
------------------------------------------------------------------

From looking at the source code of qpdf, "reported number of objects" is /Size . The other one is the highest object number, which includes deleted objects.

https://github.com/qpdf/qpdf/blob/main/libqpdf/QPDF.cc

{noformat}
<<
/Length 39596
/ID [<3332E8C840564462886D36D08BED58A0> <8E1FABB3067A4553A2E4CE0BB4292802>]
/Info 7 0 R
/Root 1 0 R
/Type /XRef
/Size 12991
/Index [0 12990]
/W [1 3 0]
/Filter /FlateDecode
>>
{noformat}



was (Author: tilman):
From looking at the source code of qpdf, "reported number of objects" is /Size . The other one is indeed the highest object number, which includes deleted objects.

https://github.com/qpdf/qpdf/blob/main/libqpdf/QPDF.cc

{noformat}
<<
/Length 39596
/ID [<3332E8C840564462886D36D08BED58A0> <8E1FABB3067A4553A2E4CE0BB4292802>]
/Info 7 0 R
/Root 1 0 R
/Type /XRef
/Size 12991
/Index [0 12990]
/W [1 3 0]
/Filter /FlateDecode
>>
{noformat}


> qpdf shows warnings trying to linearize file modified by PDFBOX
> ---------------------------------------------------------------
>
>                 Key: PDFBOX-5561
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5561
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.27
>            Reporter: menteith85
>            Priority: Minor
>
> I have a PDF file* that is generated by a software other than PDFBox. When the PDF is modified by code given below using PDFBOX, *qpdf* shows the following warning:
> {code:java}
> WARNING: modified.pdf: reported number of objects (12991) is not one plus the highest object number (12989)
> qpdf: operation succeeded with warnings; resulting file may have some problems{code}
> Note the warning is not shown when *qpdf* analyses original pdf file (ie. pdf not modified by PDFBox).
> Here's the code to modify PDF in question:
>  
> {code:java}
> for (final PDPage page: document.getPages()) {
>     page.getAnnotations().forEach(annotation - > {
>         if (annotation instanceof PDAnnotationLink link) {
>             final PDPageXYZDestination destination = new PDPageXYZDestination();
>             destination.setPage(document.getPage(1));
>             final PDActionGoTo action = new PDActionGoTo();
>             action.setDestination(destination);
>             link.setAction(action);
>         }
>     });
> } {code}
>  
> I forgot to mention that the result file generated by PDFBox is almost as twice as big as the original one.
> *I've sent the file to Tilman Hausherr.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org