Scanned PDF to Markdown: text extraction and OCR checks
August 9, 2026 · Oyren AI Team (AI-written)
Recommendation: A PDF with a selectable text layer should go through direct text extraction first. An image-only scanned PDF requires optical character recognition (OCR). Because an OCR job can return HTTP 200 and create an empty Markdown file, the acceptance check is always the saved file content, never the request status alone.
Choose or create a workspace, upload a PDF and open it from the file list.
A scanned page can look sharp on screen while containing zero selectable character objects. That structural difference explains why a PDF opens normally in a viewer while a browser text converter returns an empty string. Converting a PDF reliably starts with identifying whether the page holds a text layer or a bitmap image, running a one-page trial, and inspecting the resulting Markdown file.
Text-layer extraction versus OCR
Two PDF files can render the exact same visible page while storing completely different internal objects. To compare both paths on identical content, a one-page test fixture was created with five lines of text and four numeric values:
OCR sample: studio quote
Rate: 65 USD
Hours: 18.5
Materials: 240 USD
Total with 20% VAT: 1731 USD
The five lines above serve as known anchor strings for testing extraction: a document heading (studio quote), an hourly rate (65 USD), a decimal quantity (18.5), a flat cost (240 USD), and a tax-inclusive total (1731 USD).
The Mind Map diagram above contrasts the two conversion pipelines from a single source page:
The top branch is the digital text-layer PDF, which stores selectable character objects. Browser-based converters built on PDF.js, including the free PDF to Markdown tool, read those text objects directly in the browser and export all five lines without consuming OCR credits.
The bottom branch is the image-only scanned PDF, which stores a 1200x720 pixel bitmap image with zero character objects. Direct text-layer extraction returns an empty string (""), so the page needs an optical recognition pass followed by a content check on the saved Markdown file.

The viewer capture above shows the image-only test PDF open inside the Oyren PDF viewer. The page header (OCR sample: studio quote) and all four numeric lines (Rate: 65 USD, Hours: 18.5, Materials: 240 USD, and Total with 20% VAT: 1731 USD) render clearly on canvas even though the file contains no underlying text layer for a browser extractor to copy.
One-page OCR trial and observed output
Uploading the 35,821-byte image-only page to an Oyren workspace and running a one-page scan in balanced mode produced the following diagnostic record:
| Check | Observed result |
|---|---|
| CheckInput fixture | Observed result1 image-only PDF page (35,821 bytes, 1200x720 px) |
| CheckDirect text-layer extraction | Observed resultPage count 1, returned text "" (empty string) |
| CheckWorkspace OCR request status | Observed resultHTTP 200 (balanced mode, page 1) |
| CheckCredits charged for the run | Observed result75 credits |
| CheckReturned Markdown payload | Observed result"" (empty string) |
| CheckWorkspace output artifact | Observed resultMarkdown file created with zero extracted lines |
The trial demonstrates why request completion and content extraction must be checked separately:
The HTTP 200 response only confirms transport and job completion: the scan endpoint accepted the page, billed 75 credits for the single-page job, and wrote an output file to the workspace. Usable text is a separate question, and here the returned Markdown string was empty. Treating file creation as proof of conversion would pass a blank note into downstream analysis or model prompts.
Verifying converted Markdown locally
Before running OCR across a multi-page report or book chapter, a single representative page should pass four content checks.
The Mind Map above breaks the one-page acceptance gate into four concrete checks on converted.md:
The first check is non-empty bytes: the output file contains actual characters, not zero bytes or whitespace. The second is anchor values: known headings, dates and numeric figures from the source page appear in the output. The third is reading order: multi-column paragraphs and figure captions were not interleaved out of sequence. The fourth is tables and math: table row headers, minus signs, subscripts and units match the visible PDF page.
For a downloaded Markdown file named converted.md, two shell commands automate the first two checks:
wc -c converted.md
rg -n 'studio quote|65|18\.5|240|1731' converted.md
Each command and flag above inspects a specific property of the exported file:
wc -c converted.md: Counts the exact number of bytes (-c) inconverted.md. A zero or near-zero byte count immediately flags an empty OCR response.rg -n 'studio quote|65|18\.5|240|1731' converted.md: Searchesconverted.mdwith ripgrep and prints matching line numbers (-n) for the known title phrase (studio quote) and the four numeric values (65,18.5with an escaped decimal point,240, and1731).
Passing the byte and anchor-string checks confirms that basic prose survived recognition. When the source page also contains mathematical notation or structured grids, the equation validation guide and PDF table extraction guide cover the symbol-level and cell-level checks required next.
Choosing the conversion path
Matching the conversion tool to the PDF representation avoids wasted OCR credits and silent empty files:
| PDF type | Route |
|---|---|
| PDF typeSelectable digital PDF | RouteThe free PDF to Markdown tool reads the embedded text layer directly in the browser |
| PDF typeImage-only scan or camera capture | RouteThe scanned-PDF workflow on a single test page first, with the output verified against known anchor values before the remaining pages are converted |
| PDF typeSource-linked research notes | RouteThe PDF-to-note-to-board workflow keeps the original PDF page open beside the converted Markdown note, so every quoted figure or equation stays traceable to its source page |
Frequently asked questions
An empty text-layer extraction on an intact file
An image-only scan stores page visuals as bitmap graphics without embedded character objects. A PDF viewer renders the bitmap normally, while a text-layer extractor returns an empty string because there are no text objects to read.
HTTP 200 without extracted text
Transport and job completion are all a 200 proves. In the one-page trial above, the OCR endpoint returned HTTP 200, charged 75 credits, and created a Markdown file while returning an empty Markdown string. Acceptance always requires checking the byte count and anchor strings inside the saved file.
Text matches and symbol accuracy
Matching words and numbers with rg only confirms that character strings appeared in the output. Subscripts, operators, and table column alignments must be compared directly against the source PDF page.
Choose or create a workspace, upload a PDF and open it from the file list.
Try it on a PDF