What this covers

  • Generated PDFs have characters; scans have pixels
  • Search, copy, extract and redact all depend on the text layer
  • OCR adds an invisible layer of guesses underneath the image
  • The two-second selection test settles which you have

Everything about a PDF that people find confusing traces back to one binary property: does this file contain characters, or does it contain a picture of characters?

The two look identical on screen. They behave nothing alike.

What the text layer is

When software writes a PDF, the content stream includes instructions to show text: this font, this size, these character codes, at these coordinates. Those character codes are the text layer. They are real characters, stored in the file, and they can be read out.

This is what a reader searches, what your cursor selects, what extraction pulls out, and what redaction deletes. It is one thing serving four purposes, which is why those four capabilities always appear and disappear together.

What a scan has instead

A scanner or a camera produces a photograph. The file contains one large image object per page and nothing else. The letters you can see are arrangements of pixels that your visual system recognises; to the file they are no more textual than a photograph of a beach.

So search finds nothing, selection highlights nothing, extraction returns an empty file, and redaction has nothing to remove. None of these are failures of the tool. There is genuinely no text in the file.

The two-second test

Drag your cursor across a line. Characters highlight: there is a text layer. Nothing happens, or the whole page turns blue: it is an image. That is the whole diagnosis.

The two kinds of document

Visually identical, functionally opposite.

Generated PDF

  • Exported from software, or printed to PDF
  • Contains real characters at real positions
  • Searchable, copyable, extractable, redactable
  • Typically 30 to 150 KB per page
  • Stays perfectly sharp at any zoom

Scanned PDF

  • Produced by a scanner or a camera
  • Contains one photograph per page
  • None of search, copy, extract or redact will work
  • Typically 200 KB to several MB per page
  • Goes soft and then blocky when zoomed

The third case: OCR

Optical character recognition reads an image of text and produces characters. Applied to a scan, it adds an invisible text layer positioned underneath the image, so the page still looks like a photograph and has become searchable.

Two things follow. The positions are estimates, so search results highlight approximately rather than exactly. And the characters are a machine's reading, so they contain errors - usually confusions between visually similar characters that a person would never make.

Why this site does not offer OCR

On clean printed text, modern OCR is very good, and there would be no great difficulty in offering it. On handwriting it is not reliable, and that is where the demand here would be.

A misread digit in a mathematical answer, or a plausible-looking misreading of a name on a script, is worse than no text at all, because it looks like data rather than like a guess. We would rather not have the feature than have one that quietly produces confident errors on exactly the documents people care most about.

What depends on the text layer

All of it, or none of it.

OperationNeeds the text layer?On a scan
SearchYesNever finds anything
Copy and pasteYesNothing to select
Text extractionYesReturns an empty file
RedactionYesRefuses, correctly
Text comparisonYesCannot compare
Reading, printingNoWorks normally
Crop, rotate, split, mergeNoWorks normally
CompressionNoWorks extremely well

Checking and using the text layer

A partial text layer

Documents are frequently mixed. A typeset paper with a scanned appendix, or a form completed by hand and then merged with a generated cover sheet, has text on some pages and none on others.

This is worth knowing because it produces the most confusing symptom of all: search works, but not for the thing you are searching for. Text extraction reports the number of pages that returned nothing, which identifies the mixed case immediately.

Before assuming a tool is broken

  • Try to select a word on the page you care about
  • Extract the text and read the empty-page count
  • Check whether only some pages lack text
  • If it is a scan, plan around it rather than looking for a workaround
  • Remember that reading, printing and page operations all still work

Questions and answers

How do I add a text layer to a scanned PDF?

Optical character recognition, which this site does not offer. Several desktop applications and operating-system tools do it well on clean printed text. On handwriting, no current system is reliable enough to trust.

Why can I see the text but not select it?

Because what you can see is an image of text. Your eye reads it; the file contains no characters. This is the most common PDF misunderstanding there is.

Does the text layer contain the formatting?

No. It contains characters, the font they were drawn in, and their positions. Bold, italic and size are properties of how they were drawn, and extraction discards all of it.

Can a text layer disagree with what is on the page?

Yes, and in two ways. An OCR layer contains misreadings. And a maliciously constructed PDF can draw one thing and store another, which is why you should read a document rather than trusting extracted text from an untrusted source.

How this was checked. Tested by extracting text from generated, scanned and OCR-processed versions of the same document, and comparing what each returned.