Fix Garbled PDF Text
Fix text that copies as gibberish or boxes
Files are processed only in this browser. Nothing is uploaded to a server.
Repair the text mapping of PDFs that copy as gibberish or empty boxes
This PDF is password-protected.
Continue in another tool
Processing…
Everything runs inside this browser. Your file is never sent to a server.
Your file is ready to download
Continue with this result
Open page preview
Changing a setting hides the previous result. Run it again to save the latest settings.
Remove the password from an encrypted PDF first. Processing focuses on page content, so bookmarks, attachments, forms and signatures may not be preserved. Keep the original and check the result.
Working…
0.0
It hasn't frozen — the result will appear when the calculation finishes.
About Fix Garbled PDF Text
Text in a PDF is a set of instructions such as “draw glyph 12 of this font here”. Which Unicode character glyph 12 represents is recorded separately, in a ToUnicode table. Without that table a viewer has to guess from the font's encoding, and when the guess fails, copied text comes out as junk or boxes and search finds nothing.
This tool finds simple fonts that lack a ToUnicode table, works out the character for each code from the font's encoding and glyph names, and attaches a new table. The shapes drawn on the page do not change.
Which fonts can be fixed
The targets are simple, single-byte fonts (Type 1, TrueType and similar) with no ToUnicode. The tool resolves code → glyph name from the /Encoding base table (WinAnsi, MacRoman or Standard) plus its /Differences list, then glyph name → Unicode. Its name table is the full Adobe Glyph List (about 4,300 names): ASCII and Western European letters, Central European letters such as ą, ę and ł, Greek (alpha and so on), Cyrillic under its afii10017-style names, Hebrew and Arabic, punctuation and symbols such as curly quotes, dashes, € and the fi/fl ligatures, plus names in the uni00E9 form.
- Skipped: composite (Type 0 / CID) fonts, which most Chinese, Japanese and Korean PDFs use.
- Skipped: Type 3 fonts, and symbolic fonts with no /Encoding at all — their code-to-shape mapping lives only inside the embedded font program.
- Skipped: fonts that already have a ToUnicode table, even a wrong one. It is never overwritten.
- Partial: meaningless names such as g12 or glyph34, or names a font maker invented, are not in the table, so those characters stay unmapped.
Why the viewer sometimes gets it right anyway
Some viewers read glyph names from /Differences themselves, so the same file can copy cleanly in one program and badly in another, or in a screen reader. Adding ToUnicode makes the mapping explicit for every consumer — viewers, text extractors, search indexes and assistive technology — rather than relying on each one's heuristics. The How PDF Files Work guide covers the wider picture of fonts and content streams.
Worked examples
A subset font renumbered with /Differences
- Input
/Encoding << /BaseEncoding /WinAnsiEncoding /Differences [1 /C /a /f /eacute] >>, no ToUnicode- Output
A ToUnicode table mapping 1→C, 2→a, 3→f, 4→é (U+00E9) is attached, and “Café” copies correctly
Codes 1–4 are control-character slots in WinAnsi, so a program that ignores glyph names drops these characters or shows boxes. The new table ties each code straight to its character.
How to use it
- Choose the PDF. There are no options to set.
- Run it: every font is checked and simple fonts without ToUnicode get a new table.
- Read the counts of fixed and skipped fonts, then copy some text from the result to confirm.
Frequently asked questions
Will it fix a Chinese or Japanese PDF that copies as garbage?
Usually not. Those documents almost always use composite (CID) fonts, which this tool skips. Running OCR to build a fresh text layer is the practical route there.
A few characters are still wrong after processing.
Their glyph names are probably missing from the name table or are meaningless. The tool fills in only the codes it can resolve and leaves the rest unmapped.
Does it correct a ToUnicode table that is already wrong?
No. Existing tables are left exactly as they are; only fonts with no table are changed.
Can I tell in advance which fonts lack ToUnicode?
The PDF info tool's font report lists each font's type and embedding. When you run this tool, the summary gives separate counts for fonts fixed and fonts skipped.
Does it help screen readers?
Screen readers and accessibility checkers rely on ToUnicode to know what the text says. Without it they may skip characters or read them wrongly, so for Western-language documents filling in the table alone can improve how they are read aloud.
Sources
- ISO 32000-1:2008 (PDF 1.7) — Adobe public copy, 9.10 Extraction of Text Content
- Adobe Glyph List Specification (adobe-type-tools/agl-specification)
Last reviewed: