Fixing text copied out of PDFs
A PDF stores positioned glyphs, not paragraphs. When you copy from it you typically get:
- a hard line break at the end of every printed line;
- words split with hyphens across lines (“re- sults”);
- ligatures such as fi, fl and ffi stored as single characters, which break search and spell checking;
- page numbers and running headers or footers (“Annual Report 2024”) repeated between paragraphs;
- odd no-break and thin spaces, and invisible soft hyphens.
The cleaner fixes each of these. Lines are rejoined into paragraphs unless the next line starts a list item or a new sentence after a heading-like line; a hyphen at a line end is removed when both parts are lowercase letters; lines that appear three or more times and don’t end like a sentence are treated as headers or footers.
Check the result
Some hyphens at line ends are real (“well-\nknown” becomes “wellknown”). Turn off Rejoin hyphenated words for text full of hyphenated compounds, or fix the few cases by hand. The notes under the result show exactly how many of each fix were applied.
To extract the text in the first place, open the PDF with the Open button (it’s read in your browser with PDF.js) or use the Document Word Counter for whole folders of files.
Worked example
Here is what the PDF Text Cleaner returns for its built-in example. Settings used: Rejoin wrapped lines: on; Rejoin hyphenated words: on; Expand ligatures (fi → fi): on. Click Try an example in the tool above to load it, then change it as you like.
Annual Report 2024
The financial year closed with strong re-
sults across all regions, and the com-
pany expanded its office network.
12
Annual Report 2024
Revenue grew in every quarter, while
costs remained stable.
Outlook
We expect further growth.
13
Annual Report 2024The financial year closed with strong results across all regions, and the company expanded its office network.
Revenue grew in every quarter, while costs remained stable.
Outlook We expect further growth.Questions
Why does text copied from a PDF have line breaks everywhere?
PDFs store text as positioned lines, not paragraphs, so each printed line ends with a break when copied. This tool rejoins them into paragraphs.
What is a ligature in a PDF?
A single character that combines letters, like fi (f+i). They look normal but break search and spell check. The cleaner expands them to separate letters.
Last reviewed · How Textkiln tools work