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

Merging PDFs results in java.io.IOException: expected='R' actual='0'

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2
    • Fix Version/s: 1.8.3, 2.0.0
    • Component/s: PDModel
    • Labels:
      None

      Description

      Merging attached files results in a PDF which isn't processable by PDFBox.
      Merging or editing the resulting PDF results in an exception: java.io.IOException: expected='R' actual='0'

      D:\pdfboxtest>java -jar pdfbox-app-1.8.2.jar PDFMerger doc1.pdf doc2.pdf result.pdf

      D:\pdfboxtest>java -jar pdfbox-app-1.8.2.jar PDFMerger result.pdf doc2.pdf result2.pdf

      Sep 05, 2013 8:18:48 AM org.apache.pdfbox.pdfparser.BaseParser parseCOSDictionary
      WARNING: Invalid dictionary, found: 'e' but expected: '/'
      Sep 05, 2013 8:18:48 AM org.apache.pdfbox.pdfparser.BaseParser parseCOSDictionary
      WARNING: Bad Dictionary Declaration org.apache.pdfbox.io.PushBackInputStream@7a4b35d5
      Sep 05, 2013 8:18:48 AM org.apache.pdfbox.pdfparser.BaseParser parseCOSDictionary
      WARNING: Invalid dictionary, found: 'e' but expected: '/'
      Sep 05, 2013 8:18:48 AM org.apache.pdfbox.pdfparser.BaseParser parseCOSDictionary
      WARNING: Invalid dictionary, found: 'e' but expected: '/'
      Sep 05, 2013 8:18:48 AM org.apache.pdfbox.pdfparser.BaseParser parseCOSDictionary
      WARNING: Bad Dictionary Declaration org.apache.pdfbox.io.PushBackInputStream@7a4b35d5
      Sep 05, 2013 8:18:48 AM org.apache.pdfbox.pdfparser.BaseParser parseCOSDictionary
      WARNING: Invalid dictionary, found: 'e' but expected: '/'
      Sep 05, 2013 8:18:48 AM org.apache.pdfbox.pdfparser.BaseParser parseCOSDictionary
      WARNING: Bad Dictionary Declaration org.apache.pdfbox.io.PushBackInputStream@7a4b35d5
      Sep 05, 2013 8:18:48 AM org.apache.pdfbox.pdfparser.BaseParser parseCOSDictionary
      WARNING: Invalid dictionary, found: 'e' but expected: '/'
      Sep 05, 2013 8:18:48 AM org.apache.pdfbox.pdfparser.BaseParser parseCOSDictionary
      WARNING: Bad Dictionary Declaration org.apache.pdfbox.io.PushBackInputStream@7a4b35d5
      Sep 05, 2013 8:18:48 AM org.apache.pdfbox.pdfparser.BaseParser parseCOSDictionary
      WARNING: Invalid dictionary, found: 'e' but expected: '/'
      Sep 05, 2013 8:18:48 AM org.apache.pdfbox.pdfparser.BaseParser parseCOSDictionary
      WARNING: Bad Dictionary Declaration org.apache.pdfbox.io.PushBackInputStream@7a4b35d5
      Sep 05, 2013 8:18:48 AM org.apache.pdfbox.pdfparser.BaseParser parseCOSDictionary
      WARNING: Invalid dictionary, found: 'e' but expected: '/'
      Sep 05, 2013 8:18:48 AM org.apache.pdfbox.pdfparser.BaseParser parseCOSDictionary
      WARNING: Invalid dictionary, found: 'e' but expected: '/'
      PDFMerger failed with the following exception:
      java.io.IOException: expected='R' actual='0' org.apache.pdfbox.io.PushBackInputStream@7a4b35d5
      at org.apache.pdfbox.pdfparser.BaseParser.parseCOSDictionaryValue(BaseParser.java:233)
      at org.apache.pdfbox.pdfparser.BaseParser.parseCOSDictionary(BaseParser.java:349)
      at org.apache.pdfbox.pdfparser.BaseParser.parseDirObject(BaseParser.java:1236)
      at org.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:559)
      at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:188)
      at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1192)
      at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1159)
      at org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:181)
      at org.apache.pdfbox.PDFMerger.merge(PDFMerger.java:68)
      at org.apache.pdfbox.PDFMerger.main(PDFMerger.java:44)
      at org.apache.pdfbox.PDFBox.main(PDFBox.java:83)

        Attachments

        1. doc1.pdf
          916 kB
          Gerhard Temper
        2. doc2.pdf
          135 kB
          Gerhard Temper

          Issue Links

            Activity

              People

              • Assignee:
                lehmi Andreas Lehmkühler
                Reporter:
                gerhardt Gerhard Temper
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: