technical how to

How to Convert PDF to Markdown: OCR, Tables, and Reading Order

Convert PDFs to reviewable Markdown by checking text layers, OCR, reading order, tables, and page furniture.

PDF pages and a reading-order path converting into a structured document
Convert PDF to Markdown

To convert a PDF to Markdown reliably, first determine whether it has a usable text layer, then validate reading order, headings, tables, links and page furniture against the original. PDF describes how content is painted on a page; Markdown needs a logical document structure. That reconstruction is why a successful export still needs review.

Convert a file with the PDF to Markdown tool.

Why is PDF-to-Markdown conversion difficult?

A PDF page can place letters at coordinates without declaring that they form a heading, paragraph, table cell or footnote. Tags may provide useful structure, but not every PDF has them and not every tag is correct. A converter therefore combines available text, positions, font properties and layout heuristics to produce Markdown.

The consequence is important: extraction can be accurate at the word level while still wrong at the document level. A two-column report can contain every sentence but interleave left and right columns. A repeated footer can become a paragraph in every chapter. A table can become a sequence of unrelated words.

Does the PDF have selectable text or need OCR?

Open the PDF and select a sentence across several pages. If the selection follows the visible words and you can copy it as text, the file likely has a text layer. That gives a converter better input, but it does not guarantee correct structure.

An image-only scan needs optical character recognition (OCR) before it can provide usable text. OCR quality depends on scan resolution, contrast, skew, language, typeface, handwriting and page damage. Treat OCR output as a transcription to verify, especially for names, numbers, legal clauses, citations and table values.

Does the PDF have selectable text or need OCR?
Source condition Likely conversion approach Required review
Tagged, one-column digital PDF Extract text and available semantic tags Headings, links and page furniture
Untagged digital PDF Infer blocks and reading order from layout Columns, sidebars, tables and captions
Scan with printed text OCR, then infer structure Recognition mistakes and all structure
Scan with handwriting Specialist recognition or manual transcription Treat output as a draft, not evidence

How do you check reading order?

Start with the pages most likely to fail: multi-column layouts, pages with sidebars, magazine-style content, tables, appendices and footnotes. Compare the first and final sentence of each extracted section with the visual source. Then check that a paragraph never jumps from one column to another before finishing its current column.

Repeated headers, footers and page numbers are another common issue. Remove them only after checking several pages: a phrase that repeats may be a real section title, a running legal notice, or pagination metadata. The goal is a documented rule, not blanket deletion.

How should headings be reconstructed?

Headings may come from PDF tags, font size, weight, position, numbering patterns or whitespace. Review the output hierarchy rather than accepting visual size alone. One top-level title should become one Markdown H1; major sections should use H2; subsections should follow in order.

Heading repair is worth doing early because it improves navigation, table-of-contents generation, search snippets and AI retrieval. Do not turn every bold sentence into a heading: bold text can be an emphasis, a table label or a warning.

What happens to tables?

Simple rectangular tables with a visible header row can often become GitHub Flavored Markdown tables. Complex tables require a different decision. Merged cells, nested tables, uneven rows, borderless columns and tables that continue across pages can lose meaning when reduced to pipes.

Use this decision rule:

  1. Use a Markdown table when each row has the same logical columns.
  2. Rewrite as headings and lists when the table is really a set of labelled facts.
  3. Use an HTML fallback only when the destination supports it and it remains accessible.
  4. Link to, or retain an image of, the source table when spatial layout is evidence.

Check totals, negative numbers, dates and footnote markers cell by cell. A table that looks well aligned can still have shifted values.

Preserve a link only when both visible text and destination can be verified. Images need an explicit policy: extract them as assets, keep a source-page reference, or describe their essential content in alt text. Citations and footnotes must remain adjacent to the statement they support.

Equations deserve a separate comparison against the page. A math expression may need LaTeX, MathML, an image, or source text depending on the target system. Never assume a line of extracted glyphs is a semantically correct equation.

A repeatable PDF-to-Markdown workflow

1. Classify the PDF

Identify whether it is digital or scanned, single or multi-column, tagged or untagged, and whether tables or equations are central to its purpose. This sets expectations before conversion.

2. Convert a difficult representative page

Do not test only the cover or the easiest page. Include one page with columns, one with a table and one with footnotes or a figure. If those results are acceptable, batch processing is more defensible.

3. Review structure before copyediting

Fix reading order and heading levels before correcting punctuation. Otherwise you risk polishing content that belongs in the wrong section.

4. Verify high-risk values

Compare tables, dates, names, formulas, citations and links with the source. OCR and layout inference can alter a small character with material consequences.

5. Preserve the source and audit trail

Keep the PDF, conversion date and any manual correction notes with the Markdown. This makes later verification possible.

Frequently asked questions

Can I convert a scanned PDF directly to Markdown?

You can create a draft, but it needs OCR and careful human review. A scan begins as pixels, so every recognized character and reconstructed block is an inference.

Why is my two-column PDF in the wrong order?

The PDF may not encode the intended reading sequence. The converter has to infer it from coordinates and layout, so compare column transitions directly with the page.

Will PDF tables become Markdown tables?

Simple tables may; complex tables need validation or a different representation. Check column alignment and totals against the original before publishing.

Is PDF or DOCX better for Markdown conversion?

Use DOCX whenever the editable source is available and semantically styled. Use the Word to Markdown guide for that workflow; PDF is the fallback when the page file is the only source.

Next step

Apply the converted Markdown review checklist before reuse, then return to the File to Markdown guide for other formats.

References