Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.0.15
Description
We use PDFTextStripper to parse some PDF documents. The parsing sometimes assumes the file template and the order of the words in it.
The following Kotlin code prints the text content of the attached file, sorted by position.
fun main() { val pdfTextStripper = PDFTextStripper() pdfTextStripper.sortByPosition = true val text = pdfTextStripper.getText(PDDocument.load(File("/path/to/file/KYPolicy2.pdf").readBytes())) print(text) }
Running this code with PDFBox 2.0.14 and 2.0.15 giving different parsing for the line
POLICY PERIOD: FROM 02/18/2018 TO 02/18/2019 (2.0.14)
POLICY PERIOD: FROM 02/18/2018 02/18/2019TO (2.0.15)
I suspect the cause is the changes done in this commit:
https://github.com/apache/pdfbox/commit/068146a9c9fe59becbd82814b6a245f8158fce22
This somehow prevents us for safely upgrading to the newer version
Attachments
Attachments
Issue Links
- relates to
-
PDFBOX-4480 Problem extracting text in newline characters and spaces beetween words
- Closed
-
PDFBOX-3464 character height 3 times higher than expected
- Closed