How PDF to Markdown conversion works in markdownwise
markdownwise converts a PDF to Markdown by first working out where everything sits on each page, then rebuilding the document from that: headings, paragraphs, columns, tables and pictures, in reading order.
A PDF doesn't store "a heading" or "a paragraph". It stores letters at positions on a page. Copying the text out line by line loses the structure, which is why pasted PDF text arrives with page numbers in mid-sentence and columns shuffled together. The engine behind markdownwise, the same one that runs epubwise, looks at the page as a whole first.
From PDF to Markdown, in six steps
Reading each page
Every letter is read with its position, size and style. A page with no usable text, such as a scan or a PDF whose fonts map to nonsense, is read with OCR instead.
Setting aside what repeats
Running heads, footers and page numbers sit in the same spot page after page. They are found and left out, so they never land in the middle of your text.
Measuring the type
The size of the ordinary body text is measured across the whole file. Lines set larger, or bold and on their own, become headings, and their sizes decide whether they are #, ## or ###.
Laying out each page
The gap between columns is measured on every page, so a two-column page is read left, then right. Ruled tables are rebuilt cell by cell, and figures are cut out as pictures.
Joining the text
Lines become paragraphs from indents, gaps and short last lines, across columns and page breaks. A word split by a hyphen at the end of a line is joined again, while real compounds like "long-term" keep theirs.
Writing the Markdown
Each piece is written in plain Markdown: headings, paragraphs, lists, tables, and image links to the files in the .zip. Characters that Markdown would read as formatting, such as a stray asterisk, are escaped so the text shows exactly as it was printed.
From Markdown to PDF
Going the other way, your Markdown is turned into a web page, laid out by a browser engine (Chromium), and printed to PDF. The page style you pick sets the typefaces, spacing and table design; tables get ruled lines, fenced code gets syntax colours, TeX maths becomes MathML that the engine draws itself, and long documents get a contents page.
That browser engine runs with scripts switched off and every request to the internet blocked. Any HTML inside your Markdown is printed as text instead of being run, and pictures come only from the .zip you upload, so a document can't reach out to other sites or run code on the server. The Markdown to PDF converter shows each style.
Where it can go wrong
Busy layouts are the hardest: magazine spreads, forms with boxes all over the page, and tables drawn without any lines. OCR can misread faded print or unusual fonts. Keep your original PDF, and check figures and names in anything you'll rely on. To see how we compare with other free tools on hard pages, read our PDF to Markdown converter test.
See it on your own file: convert a PDF to Markdown, free and without an account, within the daily free limits.