How the PDF to Markdown Converter Works
AnyTool PDF to Markdown reads a PDF entirely in the browser with pdf.js, whose worker is bundled into the app and served from the same origin — never loaded from a CDN — so the tool stays fully offline-capable and uploads nothing. A PDF stores no semantic document model, only positioned glyphs, so for each page the converter calls getTextContent() to obtain every text run with its position (the transform matrix x/y), font size (the transform’s vertical scale), width and font name. It groups runs that share a baseline into lines, orders them left-to-right, inserts spaces from x-gaps that pdf.js omitted, and reconstructs the page. Structure is then inferred heuristically: the median font size across the document is taken as the body text, and lines whose size is about 1.8×, 1.45× or 1.18× larger become #, ## or ### headings; lines beginning with a bullet (•, -, *, –) or a counter (1., a)) become Markdown list items; runs in a Bold-weight font are wrapped in **…**; and soft-wrapped lines are merged into flowing paragraphs with hyphenated words rejoined.
- Text read with pdf.js getTextContent() — position, font size, width, font name
- pdf.js worker bundled locally (pdf.worker.min.mjs?url) — no CDN
- Lines rebuilt from glyph coordinates; x-gaps restore missing spaces
- Headings inferred from font size relative to the document median
- Lists, bold and de-hyphenated paragraph merging applied heuristically
