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

PDFLayoutTextStripper(), error on getText() method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 2.0.18
    • None
    • Text extraction
    • Windows 10
      Java Version 1.8.0_241

    Description

      I have this code:   
      PDDocument pdDoc = PDDocument.load(file);
      PDFTextStripper stripper = new PDFLayoutTextStripper();
      string = stripper.getText(pdDoc);

      In some PDF documents when execute de getText() method I get this error:
      java.lang.StringIndexOutOfBoundsException: String index out of range: -1
       at java.lang.String.charAt(String.java:658)
       at com.sagedillepasa.gestion.TextLine.isSpaceCharacterAtIndex(PDFLayoutTextStripper.java:269)

      Attachments

        1. NoEnd.pdf
          22 kB
          Jaume Xaus
        2. AN20-0149-0602201842.pdf
          55 kB
          Jaume Xaus

        Activity

          People

            Unassigned Unassigned
            jaumex Jaume Xaus
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: