PDFOCRTroubleshooting

PDF text selection not working: a diagnostic workflow

October 16, 2026 · Oyren AI Team (AI-written)

A clear acetate sheet lifts away from a halftone printed page.

Recommendation: PDF text selection fails for four different reasons: the viewer is in a drawing or hand tool, the page is an image with no text layer, the text layer maps to the wrong characters, or the layout is read in the wrong order. Two Poppler commands, pdffonts and pdftotext, tell these cases apart in under a minute, and only the image-only case needs OCR.

Choose or create a workspace, upload a PDF and open it from the file list.

Four symptoms, four causes

Testing text selection on a standard body paragraph (avoiding display titles or figure labels that may be outlined as vector paths) immediately narrows the failure to one of the five rows below:

SymptomLikely causeCheckFix
SymptomA drag draws, highlights or moves the pageLikely causeThe viewer has a non-text tool activeCheckSwitch to the text selection toolFixNo change to the file
SymptomNothing on the page can be selectedLikely causeThe page is a scanned image with no text layerCheckpdffonts lists no fontsFixOCR the affected pages
SymptomSelection works, pasted text is garbageLikely causeFonts have no usable Unicode mappingCheckpdffonts shows no in the uni columnFixOCR or manual correction
SymptomWords are right, sentences come out of orderLikely causeColumns, captions or footnotes interleaveCheckCompare pdftotext with and without -layoutFixReorder the excerpt against the page
SymptomThe reader shows a copy restriction or an errorLikely causeThe file is encrypted or damagedCheckpdfinfoFixRequest an unrestricted or complete copy

Opening the same page in a second PDF viewer separates viewer-state issues from file-level issues in seconds. When the paragraph selects and copies cleanly in the second viewer, the first viewer had a panning or annotation tool active. When both viewers fail in the same way, the cause lives inside the PDF file structure.

Viewer tool mode

Most desktop and browser PDF readers place the text-selection cursor, the hand (pan) tool, the highlighter, and freehand drawing tools on the same toolbar. Whenever the hand or drawing tool is active, dragging across a paragraph pans the canvas or draws a stroke without highlighting any characters. Firefox's PDF viewer documentation illustrates how switching back to the text-selection tool restores normal copying without modifying the PDF.

What a PDF page contains

When the viewer tool is set to text selection and copying still fails, the behavior depends on which of four internal representations the page uses:

Mind map of four kinds of PDF page content: font glyphs with a ToUnicode map, glyphs without one, a scanned image only, and a scanned image with an OCR text layer

A born-digital PDF exported from LaTeX or a word processor normally stores font glyphs alongside a ToUnicode character map so every visible letter maps cleanly to a Unicode code point when copied. Some older or custom-subset PDFs draw font glyphs without a valid ToUnicode table, leaving the page crisp on screen while clipboard copy produces replacement boxes or scrambled symbols. A raw scanned page stores only a raster bitmap with no selectable glyphs at all. Finally, an OCR-processed scan keeps the visible bitmap in front and places an invisible, selectable text layer behind it whose copy accuracy tracks the OCR engine's recognition quality.

Text layer check with pdffonts and pdftotext

Poppler's command-line utilities (poppler-utils on Debian and Ubuntu, poppler on Homebrew) inspect a page's font tables and text stream directly from the terminal:

pdffonts -f 3 -l 3 paper.pdf
pdftotext -f 3 -l 3 paper.pdf -

Passing -f 3 -l 3 restricts both commands to page 3 of paper.pdf, and the trailing - in pdftotext prints extracted text to standard output.

In the pdffonts output table, each font used on page 3 appears on its own row with name, emb (whether the font file is embedded), and uni (whether the font includes a ToUnicode mapping). An empty table with only column headers proves that page 3 draws zero text glyphs and is a pure image scan. A table that lists fonts with no in the uni column explains why selecting text highlights the line visually while pasting yields garbled characters. Running pdftotext confirms the diagnosis: empty output on a visually text-heavy page indicates a raster scan, whereas readable output shows that the text stream is intact.

Image-only pages and OCR

Image-only pages are the only case that requires optical character recognition. OCRmyPDF adds a searchable, selectable text layer behind the page bitmap while leaving existing digital pages untouched:

ocrmypdf -l eng --pages 3-5 --skip-text paper.pdf paper-ocr.pdf

Here -l eng selects the English Tesseract model (multi-language documents can pass -l eng+deu), --pages 3-5 restricts OCR to pages 3 through 5, --skip-text bypasses any page in that range that already has a text stream, and paper-ocr.pdf writes a new file so paper.pdf remains untouched.

Because OCR infers characters from pixel shapes, any passage copied from paper-ocr.pdf should be checked against the visible scan before quoting, paying particular attention to subscripts, minus signs, and mathematical symbols covered in the scientific PDF OCR article. When the goal is an editable Markdown note in free Oyren Docs, the scanned PDF guide walks through selecting specific pages and reviewing the credit estimate before running OCR in the workspace.

Wrong characters after copying

When text highlights normally on screen but pastes as empty boxes, shifted ASCII codes, or unexpected symbols such as Ɵ in place of ti, the embedded font lacks a valid ToUnicode table. For a long passage with a broken character map, forcing an OCR pass or running a vision-based PDF-to-Markdown conversion reads the rendered glyph shapes directly and bypasses the corrupted font table.

Two minor copy artifacts look similar to font-mapping bugs but require only a quick text edit. Typographic ligatures (fi, fl, ff) sometimes copy as a single combined Unicode ligature code point that breaks exact-string searches until replaced with separate letters, and line-break hyphens (distri- at a column margin) paste with a literal hyphen and newline that need rejoining.

Columns and reading order

When every copied word is spelled properly but sentences from the left and right columns alternate, the PDF stores text blocks in drawing order without sorting into reading order, as documented in PyMuPDF's text recipes. Comparing default pdftotext output against -layout mode shows how Poppler groups the columns:

pdftotext -f 3 -l 3 paper.pdf -
pdftotext -layout -f 3 -l 3 paper.pdf -

Without -layout, Poppler analyzes block coordinates and usually outputs the left column followed by the right column. With -layout, Poppler preserves horizontal character spacing across the full page width so both columns appear side by side on each terminal line, making it easy to verify which paragraph belongs to which column and strip out interleaved figure captions, running headers, or footnotes.

Restricted and damaged files

A PDF encrypted with copy-permission flags blocks clipboard extraction even when a complete Unicode text layer is present. Running pdfinfo paper.pdf displays an Encrypted: line listing active restrictions such as copy:no; resolving permission locks requires obtaining an unrestricted copy from the author or publisher. When pdfinfo instead reports syntax errors or truncated xref tables from an incomplete download, fetching a fresh copy of the file from the source repository resolves the failure.

Common questions on PDF text selection failures

Selection working in one PDF reader and failing in another

Because both viewers read the same underlying file, a failure in only one viewer almost always comes from an active hand, pan, highlight, or drawing tool in that application's toolbar, or occasionally a browser PDF renderer struggling with a non-standard embedded font that a desktop viewer handles.

When OCR is needed for PDF text selection

OCR is strictly necessary only when pdffonts shows that the page contains no font glyphs (a scanned image) or when a broken ToUnicode table makes a long passage unreadable on the clipboard. Viewer tool modes, typographic ligatures, line-end hyphens, and multi-column reading order are resolved without OCR.

Preserving the original PDF file during OCR

Both ocrmypdf paper.pdf paper-ocr.pdf and Oyren's workspace OCR leave the original PDF unmodified: ocrmypdf writes a separate output PDF, while Oyren creates a companion Markdown note in free Oyren Docs beside the source file.

Choose or create a workspace, upload a PDF and open it from the file list.

Open a PDF workspace

Scanned PDF OCR to Markdown notes