[ 
https://issues.apache.org/jira/browse/PDFBOX-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

menteith85 updated PDFBOX-5561:
-------------------------------
    Description: 
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:

{\{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}}

Note the warning is not shown when *qpdf* analyses original (ie. pdf not 
modified by PDFBox) PDF.

Here's the code to modify PDF in question:

{{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);         }{}}}{{    });}}
{{}}}

I've sent the file to Tilman Hausherr.

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

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

Note the warning is not shown when *qpdf* analyses original (ie. pdf not 
modified by PDFBox) PDF.

Here's the code to modify PDF in question:

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);
        }
    });
}

* I've sent the file to Tilman Hausherr.


> 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:
> {\{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}}
> Note the warning is not shown when *qpdf* analyses original (ie. pdf not 
> modified by PDFBox) PDF.
> Here's the code to modify PDF in question:
> {{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);       
>   }{}}}{{    });}}
> {{}}}
> I've sent the file to Tilman Hausherr.



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