Ligatures such as fi and fl, currency signs, and accented letters are common failure points when text is extracted from a PDF. The characters may look perfect on the page but come out as blanks, wrong letters, or missing glyphs in the extracted text, which then corrupts any search, quote, or table built from it.
What you need
- pdftotext installed
- A PDF containing ligatures or special characters
- A text editor that shows the extracted output as plain text
Step 1: Extract the text
Run pdftotext file.pdf out.txt and open the output. Look for the words and symbols you know appear on the page.
Step 2: Check the problem characters
Search the output for fi and fl ligatures, the pound and euro signs, and any accented letters. Note each one that is missing, replaced, or turned into a blank.
Step 3: Try a different output encoding
If characters are wrong, re-run pdftotext with an explicit output encoding and compare the results; the manual notes that ligatures and special characters may not render properly in all encodings.
Worked example: synthetic character check on a one-page invoice
The table below is a synthetic example. It shows the expected result of checking special characters; no extraction was run.
| Character on page | In extracted text | Verdict |
|---|---|---|
| fi in ‘final’ | final | Correct |
| fl in ‘flow’ | fow | Wrong – ligature lost |
| Pound sign in ‘GBP 120’ | GBP 120 | Correct |
| Euro sign in ‘EUR 95’ | EUR 95 | Correct |
Expected result (UNTESTED). 3 of 4 checked characters extract correctly, but the fl ligature in flow comes out as fow, so the extracted text misspells the word. Do not trust extracted text for ligature-heavy words without checking them. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- Ligatures and special characters may not render properly in all output encodings, so a failure may be an encoding choice rather than a broken PDF.
- The fix depends on the font used to create the PDF; some fonts embed no mapping for their ligatures at all.
- A visual check of the page is the only way to know what the characters should be.
