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

java.io.IOException: For input string: "2152829241"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 1.6.0
    • Fix Version/s: None
    • Component/s: Swing GUI
    • Labels:
      None
    • Environment:
      Windows 7 / Windows XP

      Description

      I had a pdf of 6 pages, size of 2,40 GB.
      I can open the PDF with AcrobatReader 9, but I cannot open with FoxitReader. (pdf corrupted)

      The code I am using to count pages is the following:
      //create a temporary file needed by the PDFBox when dealing with PDFs really really large
      temp = new File("e:/temp.tmp");
      //using random access file needed for PDF really large
      rand = new RandomAccessFile(temp,"rw");
      doc = PDDocument.load(file,rand);
      nr = doc.getNumberOfPages();

      I receive the following exception:
      java.io.IOException: For input string: "2152829241"
      at org.apache.pdfbox.pdfparser.PDFParser.parseXrefTable(PDFParser.java:730)
      at org.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:452)
      at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:184)
      at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1069)
      at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1022)
      at PDFBoxExample.getHugeNrOfFiles(PDFBoxExample.java:36)
      at PDFBoxExample.main(PDFBoxExample.java:257)

      After searching in your code , I found the cause of the exception is NumberFormatException , due to 2152829241 =>
      Integer.parseInt(2152829241) crashes , because 2152829241 > Integer.MAX_VALUE

      I have made several changes to the source code :
      XRefTrailerResolver
      COSDocument
      PDFParser
      COSWriter
      BaseParser
      XRefTrailerResolver

      changing from int to long => code worked
      Is it possible for you to change the code accordingly or I can send you the classes.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                lehmi Andreas Lehmkühler
                Reporter:
                azapuc Anca Zapuc
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: