TomRoush / PdfBox-Android

The Apache PdfBox project ported to work on Android
Apache License 2.0
986 stars 257 forks source link

PDFTextStripper.getText misses some characters from a PDF file #519

Open jamiehiggins opened 1 year ago

jamiehiggins commented 1 year ago

When attempting to extract text from the attached simple PDF file there are some characters missing within the text.

To reproduce the problem simply call pdfStripper.getText() on the attached pdf file (Problematic.pdf)

The text is mostly returned ok, however the following issues are present in the returned text:

making time to reflect and review your -> making time to reect and review your If you find it easier -> If you nd it easier

PdfBox-Android version: [e.g. 2.0.27.0] It happens on all versions of Android SDK (I have tried several)

Problematic.pdf

THausherr commented 11 months ago

This is an unsolved problem https://issues.apache.org/jira/browse/PDFBOX-3248

In this file, the /ToUnicode file maps ligatures to 0 and uses the /ActualText feature in the content stream which PDFBox doesn't support.