Why Does Text Come Out Garbled When Copied From a PDF?
Copy text out of a PDF and one of three things happens: it pastes cleanly, the words run together, or you get complete gibberish. Each has a different cause.
How PDF stores text
A PDF does not store words or sentences. It stores positioned glyph drawings: "draw glyph 65 of this font at these coordinates". You read "hello" on the page, but the file holds five separate drawing instructions.
Copying reads those instructions back and tries to turn them into text. That is a translation, and it does not always work.
Three different failures
| Symptom | Cause | Fixable? |
|---|---|---|
| Nothing copies at all | Scanned document, no text layer | Yes, with OCR |
| Nonsense characters | Missing font mapping (ToUnicode) | Hard; OCR is more practical |
| Words run together | Position jumps instead of space characters | Partly, by hand |
| Line breaks disappear | No paragraph structure | By hand |
| Columns interleave | Reading order undefined | By hand |
Where the gibberish comes from
Every font has its own glyph numbering, and those numbers need not match Unicode code points. The PDF producer is supposed to embed a ToUnicode table saying which glyph corresponds to which character.
When that table is missing or broken, the copying program treats glyph numbers as character codes and you get garbage. The page still looks right, because the drawing instructions are intact; what is broken is only the record of "which letter this shape was".
Why words run together
A space in a PDF is not always a space character. Producers often say "draw the next word 4 units to the right" with no character in between. The copying program has to infer the space.
When the inference threshold is off, two things happen: narrow gaps are ignored and words merge, or normal letter spacing is read as spaces and a single word comes out as "w o r d". The second is common in headings and letter-spaced designs.
Reading order in multi-column documents
On a two-column page, in what order is the text stored? PDF does not define that — drawing order need not match visual reading order. So text copied from a two-column academic paper can alternate a line of the left column with a line of the right.
Some documents carry a "tagged PDF" structure that resolves this (documents produced for accessibility usually do). Most do not, and then selecting one column at a time is the only practical approach.
What to do
- Test first: Copy one paragraph into a plain text editor. Do not look for a fix before you have seen the failure.
- Nothing copies: The document is scanned; you need OCR.
- Gibberish: The font mapping is broken; rasterise and OCR.
- Text present but messy: Copy in small sections and clean up with find-and-replace.
- Multi-column: Select each column separately.
One last warning: do not take copied text on trust, especially numbers. Confusions between 1/l, 0/O and 5/S occur both in OCR and in broken mappings, and they are the hardest kind of error to spot.
Frequently asked questions
Why is the copied text nonsense?
The ToUnicode table that maps the font's glyph numbers to Unicode characters is missing or broken. The page still looks right because the drawing instructions are intact; only the record of which letter each shape was is damaged.
Why do words run together?
A space in a PDF is not always a space character; producers often just draw the next word slightly to the right. The copying program has to infer the gap, and a wrong threshold merges words.
Why do lines interleave in two-column documents?
PDF does not define reading order, and drawing order need not match visual order. In documents without tagging, selecting one column at a time is the only practical approach.
Can a broken font mapping be repaired?
Not in practice. The text is not present in readable form in the file. The fix is to rasterise the pages and regenerate the text with OCR.
More guides
Working With PDFs on a Phone: What Works and What Does Not
Merging, signing and scanning PDFs on a phone, where memory limits kick in, and which jobs are better left to a computer.
PDF Won't Open: Is the File Really Corrupted?
Why a PDF fails to open, what a "corrupted file" error really means, which cases are recoverable, and what to try before making things worse.
How to Reduce PDF File Size
Why a PDF ends up at 40 MB, what actually inflates it, and how far you can go without wrecking quality. What compression really does.
Try Konta PDF
Merging, splitting, reordering, encrypting, OCR and image-to-PDF are free. Files are processed in your browser.
Open the tools