Highlight every occurrence of a word in a PDF
Highlighting text in a PDF means drawing a translucent colored rectangle over a word so it stands out without hiding it. This tool searches the PDF's selectable text layer for the word or phrase you type, case-insensitively, and draws a translucent yellow highlight over every occurrence on every page in one pass. The highlighted copy is built entirely in your browser and downloaded — your file is never uploaded.
How it works
Every text-based PDF carries two representations of its words. The visible one is the drawing instructions in each page's content stream. The searchable one is the text layer: a sequence of text runs, each recording a string of characters together with the font, size and a transformation matrix that pins the run to exact page coordinates. This tool reads that text layer with the pdf.js parsing library, which returns every run on a page along with its position, width and height in PDF points.
The search itself is a case-insensitive string match over those runs. For every run containing the search term, the tool computes the horizontal offset of the match inside the run — proportional to the character positions, scaled by the run's width — and derives a rectangle that covers just the matched characters. It then uses the pdf-lib library to draw a yellow rectangle with reduced opacity at those coordinates on the same page. Because the rectangle is translucent and painted over the glyphs, the words remain readable, selectable and searchable underneath; nothing in the original content is altered or removed.
Two limitations follow directly from this method. First, a phrase that breaks across a line ending or a column boundary is stored as two separate runs, so a multi-word search may miss those occurrences; searching for a single distinctive word is more reliable. Second, a scanned PDF has no text layer at all — each page is just an image — so there is nothing to match. For scans, run OCR on the PDF first, or create a searchable PDF with an invisible text layer, and then highlight the result.
Worked example: marking one defined term in a lease
A 48-page commercial lease (1.8 MB) needed every mention of the defined term “Landlord” marked for review. Typing landlord and running the tool found 137 occurrences spread over 41 of the 48 pages — including “LANDLORD” in the all-caps headings, because matching ignores case. Processing took about six seconds, and the output grew only slightly, from 1.8 MB to 1.9 MB, since each highlight adds just a small rectangle-drawing instruction rather than any image data. Three occurrences of the two-word phrase “Landlord's agent” that wrapped across line endings were caught anyway, because the search term was the single word rather than the full phrase.
Frequently asked questions
Can I highlight every instance of a word in a PDF at once?
Yes. Enter the word once and the tool scans the entire text layer, drawing a translucent yellow highlight over every occurrence on every page in a single pass. You do not need to click each match individually.
Why does the tool find no matches in my scanned PDF?
A scanned PDF stores each page as a photograph, so there is no selectable text layer to search. Run the file through an OCR tool first to add a text layer, then highlighting will work.
Does highlighting change or delete the original text?
No. The highlight is a translucent rectangle drawn on top of the page, and the text underneath remains fully intact. You can still select, copy and search the highlighted words afterwards.
Why was a phrase missed even though I can see it on the page?
Matching runs over the text runs the PDF actually stores, and a phrase that breaks across a line ending or a column boundary is stored as separate runs. Searching for a single distinctive word from the phrase usually finds those spots.
Is the search case-sensitive?
No, matching is case-insensitive. Searching for invoice will also highlight Invoice and INVOICE, which is normally what you want when marking up a document.
Is my PDF uploaded to a server to be highlighted?
No. The file is opened, searched and rebuilt with JavaScript running in your own browser, and it never leaves your device. The page even works offline once it has loaded.