Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-5561

qpdf shows warnings trying to linearize file modified by PDFBOX

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.0.27
    • None
    • Writing
    • None

    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 pdf file (ie. pdf not modified by PDFBox).

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

      Attachments

        Activity

          People

            Unassigned Unassigned
            menteith85 menteith
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: