How to actually edit the text in a PDF

· 5 minute read

Most "PDF editors" put a text box on top of the page. Editing the real words is a different, harder thing — here is what it involves and what to expect.

Search for a PDF editor and nearly everything you find does the same thing: it draws a new text box on top of the page. That is useful for filling in a form or signing something. It is not editing the document, and the difference shows the moment you need to change a word in an existing sentence.

Two different things called editing

Overlaying puts new content on top of the page. The original text is untouched underneath. If you want to change "March" to "April" in an existing paragraph, you have to cover the old word with a white rectangle and type the new one next to it — and it will not match the surrounding font, the spacing will be slightly wrong, and anyone who selects the text will find both words there.

Real editing changes the content stream: it finds the instruction that draws "March", changes it, and rewrites the page. The word is gone, not hidden. Selecting the text finds only the new one.

Why the second one is hard

A PDF stores text as positioned glyphs, usually in a font that has been subsetted — only the characters the document actually uses are embedded. If your document never contained a capital Q, the font in the file may have no capital Q in it at all.

So an editor that changes the words has to check whether the characters you typed exist in the embedded font, and either use them, extend the font, or substitute one that will look close. It also has to re-lay-out the line, because the replacement is a different width, and decide whether the paragraph re-wraps.

That is the work. It is why so few tools do it and why the ones that do are the paid ones.

What to expect when it works

  • Edited text should match the surrounding text exactly, because it is using the same embedded font.
  • Selecting and copying the paragraph afterwards should give you the new wording, not both versions.
  • The rest of the page should not move. A PDF page is fixed; editing a line does not reflow the document the way Word would.
  • Very unusual fonts, heavily stylised type and text that is actually part of an image will resist editing. Text in an image is not text — that needs OCR first.

When an overlay is the right answer anyway

Not everything needs the harder approach. Filling in a form, adding a signature, initialling a page, annotating a draft for somebody else, stamping a document as a copy — all of these are additions rather than changes, and an overlay is exactly right for them. It is faster and it leaves the original intact, which is often what you want.

Use real editing when the change has to look like it was always there. Use an overlay when it should be visible that something was added.

A word about scans

If your PDF came from a scanner or a phone camera, the page is a photograph. There is no text to edit, only an image of text, and no editor can change words that are not there. Run OCR over it first: that produces a text layer you can then work with. Expect OCR to be very good on clean printed text and unreliable on handwriting, faint print or anything at an angle.

More writing about PDFs · Loopdraw’s PDF tools