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

PDFTextStripperByArea dies on Chinese/Japanese files

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.12
    • 2.0.13, 3.0.0 PDFBox
    • PDModel

    Description

      I'm using PDFTextStripperByArea, this code makes it die:

      stripper.extractRegions(page);

      Assuming, the language is Chinese or Japanese, that's the error:

      ===========

      Oct 19, 2018 1:24:50 AM org.apache.pdfbox.pdmodel.font.PDFont getSpaceWidth
      SEVERE: Can't determine the width of the space character, assuming 250
      java.io.IOException: Unexpected end of stream
      at org.apache.pdfbox.pdmodel.font.PDType3CharProc.getWidth(PDType3CharProc.java:170)
      at org.apache.pdfbox.pdmodel.font.PDType3Font.getWidthFromFont(PDType3Font.java:165)
      at org.apache.pdfbox.pdmodel.font.PDFont.getSpaceWidth(PDFont.java:547)
      at org.apache.pdfbox.text.LegacyPDFStreamEngine.showGlyph(LegacyPDFStreamEngine.java:265)
      at org.apache.pdfbox.contentstream.PDFStreamEngine.showText(PDFStreamEngine.java:734)
      at org.apache.pdfbox.contentstream.PDFStreamEngine.showTextString(PDFStreamEngine.java:595)

      =========

      Should I use something else instead of PDFTextStripperByArea?

      Let me know if more information needed. I attached the PDF file.output.pdf

      ====

      To reproduce use the attached  above output.pdf and the standard PDFBox app:

       java -jar pdfbox-app-2.0.12.jar ExtractText output.pdf 

       

      Attachments

        1. output.txt
          1 kB
          Tilman Hausherr
        2. output.pdf
          2.78 MB
          Ilya Kantor

        Activity

          People

            tilman Tilman Hausherr
            iliakan Ilya Kantor
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: