This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /blog/optical-character-recognition-in-scanned-pdfs.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. How to make a PDF searchable: OCR for scanned PDFs

Table of contents

    How to make a PDF searchable: OCR for scanned PDFs
    TL;DR

    A scanned PDF is an image of a page, so its text can’t be searched, selected, or copied. Optical character recognition (OCR) makes a PDF searchable by recognizing the text in the image and adding it as an invisible text layer. The page looks the same, but search, copy and paste, and text-based redaction all work. Nutrient makes PDFs searchable through the OCR API, the .NET SDK, Document Engine, and the iOS and Android SDKs.

    Scanning paper documents into PDFs removes the need for filing cabinets, but a scan is a picture of a page. A PDF that only contains that picture has no text for software to work with:

    • Searching for a word returns no results.
    • Text can’t be selected, highlighted, or copied.
    • Redacting a term means finding and covering every instance by hand.
    • Search tools and document management systems can’t index the content.

    Making the PDF searchable fixes this. The process is optical character recognition (OCR).

    What is a searchable PDF?

    A searchable PDF contains two layers on each scanned page: the original image, and a text layer with the recognized words. The text layer is invisible, and each word is positioned over the matching word in the image. A reader displays the image, while search, selection, and copy operations use the text underneath.

    Because the image stays in place, the page looks exactly as it did before OCR. That’s the difference between a searchable PDF and a converted text document: OCR adds text to the PDF without changing its appearance.

    PDFs created digitally — exported from a word processor or generated by an application — already contain real text and don’t need OCR.

    How to check whether a PDF is searchable

    Open the PDF and try one of these checks:

    1. Search for a word that appears on the page. If the viewer finds no matches, the page has no text layer.
    2. Try to select a line of text. If the selection draws a box over the whole page instead of highlighting words, the page is an image.
    3. Copy text from the page and paste it elsewhere. Missing or garbled text points to a page without a usable text layer.

    A document can mix both kinds of pages, such as a digital report with a scanned signature page appended. Check each kind of page, not only the first one.

    How OCR makes a PDF searchable

    OCR software works through three stages to turn a scanned page into a searchable one.

    Find the text on the page

    The software first identifies where text exists in the image. Image processing such as binarization(opens in a new tab), skew correction, and noise reduction raises the contrast between text and background, which makes text regions easier to detect.

    Recognize the characters

    Each line of text is then analyzed to determine its characters. Fonts, sizes, and handwriting vary widely, so modern OCR engines use machine learning(opens in a new tab) trained on large sets of examples instead of fixed rules. The language setting matters here: An engine configured for the document’s language recognizes its characters and words more accurately.

    Embed the text in the PDF

    Finally, the recognized text is written into the page content as invisible text. Each word is scaled and positioned to sit over its image in the scan. The PDF format supports text that’s in the page content but not drawn, so readers can search and select it while displaying the original image.

    How to make a PDF searchable with Nutrient

    Nutrient provides OCR in several products. The right one depends on where the PDFs are processed.

    Use the OCR API

    The Nutrient OCR API makes PDFs and images searchable through a single HTTP request, with no OCR engine to install. Send the file to the /build endpoint with an ocr action and the document’s language:

    Terminal window
    curl -X POST https://api.nutrient.io/build \
    -H "Authorization: Bearer <YOUR-API-KEY>" \
    -o result.pdf \
    --fail \
    -F scanned=@document.pdf \
    -F instructions='{
    "parts": [
    {
    "file": "scanned"
    }
    ],
    "actions": [
    {
    "type": "ocr",
    "language": "english"
    }
    ]
    }'

    The returned result.pdf has searchable, selectable text. The scanned PDF OCR tutorial covers account setup and supported languages. The OCR API guide for JavaScript, Python, PHP, and Java shows the same request in other languages.

    Use the .NET SDK

    For applications that process files on their own servers, Nutrient .NET SDK runs OCR locally. This example makes every page of an image-based PDF searchable in one call:

    using GdPicturePDF pdf = new GdPicturePDF();
    pdf.LoadFromFile(@"input_image_based.pdf");
    pdf.OcrPages("*", 0, "eng", "", "", 200);
    pdf.SaveToFile(@"output.pdf");

    The PDF-to-searchable-PDF guide also shows page-by-page processing and the OCR parameters. To start from scanned images instead of a PDF, see converting images to searchable PDFs.

    Use Document Engine or the mobile SDKs

    Document Engine applies the same ocr action on the server, either when a document is uploaded or to documents it already stores. In mobile apps, the iOS and Android SDKs add OCR through an OCR library and language packs bundled with the app. A scanned document becomes searchable without leaving it. On iOS, OCR runs entirely on the device.

    Get accurate OCR results

    OCR quality depends mostly on the input. The OCR API tutorial recommends:

    • Resolution — Scan at 200–300 dots per inch (DPI). Higher resolutions don’t necessarily improve accuracy.
    • Clarity — Use clean, high-contrast scans without heavy compression, noise, or skew.
    • Language — Set the document’s language, and specify every language a multilingual document uses.

    After OCR, spot-check the result by searching for a few words from different parts of the document. Names, numbers, and table contents are the most likely to contain recognition errors.

    What a searchable PDF enables

    With a text layer in place, the scanned document supports the same text operations as a digital one:

    • Search — Search within the document, or index archives so documents can be found by their content.
    • Annotation — Highlight, underline, and mark up text with annotations.
    • Redaction — Search for a term and redact every match instead of covering each instance by hand.
    • Copy and extraction — Copy passages or extract the text for other systems.

    A searchable PDF isn’t automatically an accessible PDF. Screen readers also need tags that describe headings, lists, tables, and reading order. PDF/Universal Accessibility (PDF/UA) covers those requirements, and OCR is usually the first step toward meeting them for scanned documents.

    Make PDFs searchable with the Nutrient OCR API

    FAQ

    How do I make a PDF searchable?

    Run optical character recognition (OCR) on the PDF. OCR recognizes the text in each scanned page and adds it as an invisible text layer. The page looks the same, but its text can be searched, selected, and copied.

    How can I tell if a PDF is searchable?

    Search for a word that appears on the page or try to select a line of text. If the search finds nothing or the selection covers the whole page as an image, the page has no text layer and needs OCR.

    Does OCR change how the PDF looks?

    No. OCR keeps the original scanned image and adds the recognized text as an invisible layer behind it. The page displays as before.

    Can I make PDFs searchable automatically?

    Yes. The Nutrient OCR API processes PDFs through an HTTP request, and Nutrient .NET SDK and Document Engine run OCR on a server. Each can process files as they’re uploaded or in batches.

    Is a searchable PDF accessible?

    Not on its own. OCR gives assistive technology text to read. An accessible PDF also needs tags for structure and reading order, plus alternative text for images, as defined by PDF/UA.

    Nick Winder

    Nick Winder

    Core Staff Software Engineer

    When Nick started tinkering with guitar effects pedals, he didn’t realize it’d take him all the way to a career in software. He has worked on products that communicate with space, blast Metallica to packed stadiums, and enable millions to use documents through Nutrient, but in his personal life, he enjoys the simplicity of running in the mountains.

    Explore related topics

    Try for free Ready to get started?