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

java.io.IOException: Error: End-of-File, expected line when opening PDF file

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Invalid
    • Affects Version/s: 1.5.0
    • Fix Version/s: None
    • Component/s: Swing GUI
    • Labels:
      None
    • Environment:
      Windows 7 64bits

      Description

      Hello,

      I am new to PDFBox. I just downloaded PDFBox v1.5.0. I created a project in Eclipse and used as source folder the content of pdfbox-1.5.0/pdfbox/src/main/java extracted from the ZIP file: pdfbox-1.5.0-src.zip. To compile the source code, I added to my projects the JARs:

      • fontbox-1.5.0.jar
      • jempbox-1.5.0.jar
      • pdfbox-1.5.0.jar
      • commons-logging-1.1.1.jar
      • bcprov-jdk16-146.jar
      • bcmail-jdk16-146.jar
      • icu4j-4_6_1.jar

      The project compiles fine. Then, I ran org.apache.pdfbox.PDFReader and open the PDF file available at http://www-etud.iro.umontreal.ca/~ptidej/yann-gael/Work/Publications/Documents/CSMR11a.doc.pdf and received the exception:

      java.io.IOException: Error: End-of-File, expected line
      at org.apache.pdfbox.pdfparser.BaseParser.readLine(BaseParser.java:1250)
      at org.apache.pdfbox.pdfparser.PDFParser.parseHeader(PDFParser.java:303)
      at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:163)
      at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:862)
      at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:829)
      at org.apache.pdfbox.PDFReader.parseDocument(PDFReader.java:330)
      at org.apache.pdfbox.PDFReader.openPDFFile(PDFReader.java:292)
      at org.apache.pdfbox.PDFReader.openMenuItemActionPerformed(PDFReader.java:241)
      at org.apache.pdfbox.PDFReader.access$1(PDFReader.java:227)
      at org.apache.pdfbox.PDFReader$2.actionPerformed(PDFReader.java:122)
      at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
      at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
      at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
      at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
      at javax.swing.AbstractButton.doClick(Unknown Source)
      at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
      at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
      at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
      at java.awt.Component.processMouseEvent(Unknown Source)
      at javax.swing.JComponent.processMouseEvent(Unknown Source)
      at java.awt.Component.processEvent(Unknown Source)
      at java.awt.Container.processEvent(Unknown Source)
      at java.awt.Component.dispatchEventImpl(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Window.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.EventQueue.dispatchEvent(Unknown Source)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.run(Unknown Source)

      I also ran the command line:

      java -jar pdfbox-app-1.5.0.jar PDFReader ..\rsc\CSMR11a.doc.pdf

      using the pdfbox-app-1.5.0.jar downloaded from the Apache Web site and received the same exception when opening the same file:

      java.io.IOException: Error: End-of-File, expected line
      at org.apache.pdfbox.pdfparser.BaseParser.readLine(BaseParser.java:1250)
      at org.apache.pdfbox.pdfparser.PDFParser.parseHeader(PDFParser.java:303)
      at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:163)
      at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:862)
      at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:829)
      at org.apache.pdfbox.PDFReader.parseDocument(PDFReader.java:330)
      at org.apache.pdfbox.PDFReader.openPDFFile(PDFReader.java:292)
      at org.apache.pdfbox.PDFReader.main(PDFReader.java:277)
      at org.apache.pdfbox.PDFBox.main(PDFBox.java:53)

      I checked the cookbook and the FAQ and Google and could not find information explaining me what I am doing wrong. Please let me know if this is indeed a bug or what I am doing wrong?

      Take care,
      Yann

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              guehene Yann-Gaël Guéhéneuc
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: