· 6 min read
Text copied out of a PDF arrives broken in a consistent set of ways, and the reason is structural. A PDF does not store paragraphs. It stores glyphs at coordinates. When you copy, software reconstructs a reading order from positions, and the paragraph structure was never there to recover.
| Symptom | Cause |
|---|---|
| A line break after every visual line | Each rendered line was a separate text object |
| Words split with a hyphen | The original was hyphenated to justify the line |
| Page numbers and headers mixed into the text | They are text objects like any other |
| Odd spacing inside words | Letter spacing applied for justification |
| Missing or merged letters | Ligatures, where fi or fl is one glyph |
| Columns interleaved | Reading order guessed wrongly across a multi-column layout |
Order matters, because some steps destroy the information later steps need.
Removing line breaks before rejoining hyphenated words is the mistake that cannot be undone. Once the break is gone, a hyphen in the middle of a sentence is indistinguishable from a real one.
A hyphen at the end of a line is usually a split word, but not always: a genuine compound can fall there too. Automatic rejoining will occasionally merge a real compound into one word. On a long document this is a reasonable trade, and it is worth a read-through afterwards rather than trusting it blindly.
Multi-column layouts are where copying fails worst, because the reading order has to be inferred from geometry. Tables are the same problem: what you get is a sequence of cells with no structure. If the table matters, it is usually faster to retype it than to repair the paste.
PDF text carries non-breaking spaces, soft hyphens and unusual whitespace, all of which survive the paste and none of which are visible. If a comparison or a search behaves oddly on cleaned text, that is usually the reason.
The tools here run in the browser, which matters because the PDF is often a contract, an invoice or a report rather than something public.
A PDF stores glyphs at positions, not paragraphs. Each visual line is a separate text object, so the copy has a break wherever the line ended on the page.
Headers and page numbers, then hyphenated words, then line breaks. Removing the breaks first destroys the signal that tells you a word was split.
Ligatures. Pairs such as fi and fl can be stored as a single glyph, and extraction sometimes fails to map it back to two letters.