PDFMove
How to Convert a PDF to Markdown: Preserving Headings and Structure
How-To

How to Convert a PDF to Markdown: Preserving Headings and Structure

7 min read

You have a PDF and you need to reuse its content: move it to a website, keep it in version control, update and republish it, or convert it to other formats. Markdown is a good intermediate format for this — flexible because it's plain text, but preserving structure like headings and links.

Why Markdown is a good target

It's plain text. It opens in any editor, can be diffed line by line in version control, and searching and bulk replacement are easy.

It carries structure. Heading levels, lists, bold/italic emphasis, links, code blocks and tables — all expressed with simple marks.

It converts easily. There are mature tools for converting Markdown to HTML, Word, PDF, presentations and more.

It works with static site generators. Most blog and documentation systems read Markdown directly.

Step 1: Check whether your PDF is suitable for conversion

Not every PDF converts equally well. Check two things.

Is there a text layer?

Open the PDF and try selecting a paragraph with your mouse. If the text is selectable there's a text layer; if it isn't, the page is nothing but an image.

Scanned documents have no text layer and there's nothing for the converter to extract. You need to apply OCR first.

Conversion works after OCR, but keep your expectations low: in a text layer added by OCR the font and size information is artificial, so structural inferences like heading detection come out weak.

How complex is the layout?

| Layout | Conversion quality | |---|---| | Single column, plain text | Very good | | Report with headings | Good | | Simple tables | Good | | Two-column layout | Weak, order can scramble | | Margin notes, boxes | Weak | | Complex tables | Weak | | Magazine/brochure design | Bad |

Multi-column layouts are the biggest problem: the converter has to guess the text's reading order from position information, and on a two-column page it can read lines horizontally left to right and interleave the text of the two columns.

Step 2: Convert

Open the PDF to Markdown converter and upload your file. The processing runs in your browser; your document doesn't go to a server.

What the converter does is extract semantic structure from the PDF's drawing commands:

  • Groups text fragments into lines and paragraphs.
  • Guesses heading levels by looking at font size and weight.
  • Detects bullets and numbers and builds lists.
  • Converts link annotations into Markdown links.
  • Tries to detect table structures.

Most of these steps are inference, so the result will be "a good starting point" rather than perfect.

Step 3: Review the output

Open the converted Markdown in an editor and check in this order.

Heading hierarchy

This is the place that most often needs fixing. Check:

  • Are headings at the right level? (# H1, ## H2, ### H3)
  • Were levels skipped? (jumping from H1 straight to H3)
  • Did emphasized sentences in bold accidentally become headings?
  • Were real headings skipped?

Fixing is easy — you just change the number of # — but it needs a read-through first.

Paragraph integrity

In a PDF a paragraph is split across multiple lines and the converter has to join them. The problems:

End-of-line hyphenation. Words split with a hyphen in the page layout ("qua-lity") can stay unjoined in Markdown. Search for them and fix.

Premature paragraph breaks. A paragraph may have been split in two.

Page transitions. If a paragraph spans two pages, a page number or footer text may have gotten wedged in the middle.

Headers, footers and page numbers

PDFs have repeating elements at the top and bottom of every page: the document title, the section name, the page number, a copyright notice.

The converter can mistake these for content and include them in the Markdown. The result is lines like "Annual Report 2025 | 47" repeating every few paragraphs.

Cleanup: because these lines repeat regularly, they can be deleted in bulk in a text editor with "replace all" or a regular expression.

Lists

Bulleted and numbered lists usually transfer well. What to check:

  • Are the indent levels of nested lists correct?
  • Do numbered lists start with the right numbers?
  • Did some items come out as paragraphs?

Tables

Markdown's table syntax is simple and has limits:

| Header 1 | Header 2 |
|---|---|
| Cell | Cell |

This structure assumes a flat grid. It can't express:

  • Merged cells (colspan/rowspan)
  • Nested tables
  • Multi-line formatting inside a cell
  • Styling beyond cell alignment

Simple tables usually transfer well. For complex ones you have two options: simplify them by hand, or write that table as HTML (most Markdown processors pass HTML through).

Links

Hyperlinks to web addresses are usually preserved:

[link text](https://example.com)

Internal document links lose their meaning — Markdown has no concept of pages. Those need to be converted into heading links (#go-to-heading).

Images

Image behavior varies by tool:

  • Some tools extract images as separate files and reference them in the Markdown.
  • Some skip images and leave only a placeholder.
  • Some embed them as base64 (which makes the file very large).

If images matter, you may need to run a separate image extraction and place them by hand.

Step 4: Cleanup and editing

The typical post-conversion cleanup list:

  1. Delete the repeating header/footer lines. Quick with bulk replacement.
  2. Fix the heading levels. Make the hierarchy sensible.
  3. Rejoin hyphenated words. "qua-\nlity" → "quality".
  4. Clear unnecessary line breaks. Mid-paragraph splits.
  5. Review the tables.
  6. Test the links.
  7. Fix the image references.

Working with a preview in an editor makes the job easier — most Markdown editors show source and preview side by side.

When Markdown isn't the right target

If visual design matters. Markdown carries no layout or design. A brochure's or magazine page's visual identity is entirely lost.

If complex tables are central. Markdown's table support is limited.

If the document will only be read. PDF is already a readable format. Conversion makes sense when you want to reuse the content.

If there are formulas and special notation. Mathematical formulas sit as drawings in the PDF; they come into Markdown as plain text and become meaningless. If you use a Markdown dialect with LaTeX support, you'll have to rewrite the formulas by hand.

Common use cases

Migrating documentation. An old user manual sits as a PDF and needs to move to a modern documentation site. Markdown is the native format of static site generators.

Republishing content. Turning a report into a blog post.

Putting it under version control. If you want to track a document's changes, PDF is a binary file and can't be diffed. Markdown is plain text and every change shows line by line.

Producing multiple formats. From a single Markdown source you can produce HTML, PDF, Word and EPUB.

Feeding AI tools. Because Markdown is plain text with its structure preserved, it makes a better input than raw PDF when working with language models.

In summary

PDF to Markdown conversion is the work of extracting semantic structure from drawing commands, and that extraction is inference-based. On single-column, regular documents the result is good; on multi-column layouts, complex tables and design-heavy pages it gets weak. Scanned PDFs need OCR first. Treat the conversion as a starting point rather than a finish line: fixing heading levels, clearing repeating header/footer lines, rejoining hyphenated words and reviewing tables are standard cleanup steps. What you end up with is a flexible source that can go into version control, be edited easily, and be converted into many formats.

Frequently Asked Questions

Can I convert a scanned PDF to Markdown?

Not directly. In scanned PDFs the page is nothing but an image with no text layer; there's no text for the converter to extract. You first need to apply OCR to add a text layer. Conversion works after OCR, but structural inferences like heading detection come out weaker than with PDFs that have a native text layer.

Why do headings sometimes come out at the wrong level?

Because the information 'this is a heading' usually isn't written in a PDF. The converter guesses by looking at font size, weight and position. If the document has five different point sizes, it tries to map them to H1 through H5. An emphasized sentence in bold can be mistaken for a heading, or a small-type subheading can be skipped. In tagged PDFs that guessing goes away and the result is far more accurate.

Do tables transfer to Markdown properly?

Simple, regular tables usually do. But merged cells, nested tables and multi-line cells have no equivalent in Markdown's table syntax — Markdown tables assume a flat grid. With complex tables you may have to fix the output by hand or write that table as HTML.

What's the benefit of converting to Markdown?

Markdown is plain text: it can be diffed in version control, edited in any text editor, fed directly to static site generators, and easily converted to many formats including HTML, Word and PDF. When you want to reuse, update or move a PDF's content to a website, Markdown provides a flexible intermediate format.

Try this out right away with PDF → Markdown.

Try PDF → Markdown