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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.0
    • Fix Version/s: 1.7.0
    • Component/s: Text extraction
    • Labels:
      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

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: