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

PDFs created with idealsoftware.com's VPE are all wrong

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.0
    • 1.7.0
    • Text extraction
    • None

    Description

      Follow the steps:

      1. Download the example pdf I'll attach. It's the same as "example rich text format" pdf from idealsoftware.com but with text extraction protection disabled.

      2a. java -jar pdfbox-app-1.6.0.jar ExtractText -sort rtf.pdf extr.txt

      Actual results:
      Text is all gibberish. If you look at it very carefully, sorting "reads" the text vertically and you find first characters of each line first, then second characters of each line, etc.
      Moreover, on jdk7: java.lang.IllegalArgumentException: Comparison method violates its general contract! (that's the text position sorting comparator)

      Poking around the code indicates that sorting is correct if character rotation was 270 degrees. It (correctly?) calculates it as zero instead.

      2b. java -jar pdfbox-app-1.6.0.jar ExtractText rtf.pdf extr.txt

      Actual results:
      Text is fine, but each page is glued to a single line. Poking around the code indicates that character offsets go down correctly, but expected line height is huge (full page height or width?) and therefore they never go down sufficiently to trigger a newline detection.

      So, there's something very wrong with character positions in those files, making pdfbox not extract text correctly.

      Attachments

        1. rtf.pdf
          297 kB
          Radek

        Activity

          People

            lehmi Andreas Lehmkühler
            syskin Radek
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: