How to use it
- Drop the PDF. The page count appears; type a page selection such as 2-9 if you only need part of it.
- Keep or switch off the detectors (headings, lists, tables, bold/italic, page-number removal, rule between pages).
- Press “Convert to Markdown”. The result panel counts words, headings, lists and tables; the Preview tab renders the Markdown.
- Copy the text or download the .md file (named after the PDF).
Example
A 3-page report set in 11 pt with a 24 pt title, 14 pt section names, two bullet lists and a 3-column price table converts to Markdown with # Annual Report, ## Introduction, dashes for the bullets and a table such as | Item | Qty | Price |followed by the separator row. The ratio 24 / 11 = 2.18 makes the title level 1; 14 / 11 = 1.27 makes the sections level 2. “Page 2 of 3” at the foot of each page is dropped; the page boundaries become --- rules.
How the structure is reconstructed
pdf.jsreturns every text run with its position, width and font size. The tool first fetches each page’s operator list so the loaded font objects reveal their weight and style (bold/italic), then groups runs into lines when their baselines differ by less than 45 % of the font size. Inside a line, a gap larger than 0.12 em gets a space and a gap larger than 1.5 em starts a new cell. The body size is the font size carrying the most characters across all pages, and headings follow:
ratio = line size / body size → ≥ 1.5: #, ≥ 1.25: ##, ≥ 1.08: ###Consecutive lines are merged into one paragraph while the vertical gap stays under 1.6 × the font size, the previous line reaches at least 75 % of the text width and the next line is not indented. Lines in the top or bottom 6 % of the page that read like “3”, “Page 3 of 9” or “- 3 -” are treated as page numbers.
Limits
- Multi-column layouts are read line by line across the columns and interleave; convert such PDFs one column at a time is not possible.
- Images, footnote markers, links and form fields are not carried over; tables with merged or wrapped cells may split into several rows.
- Scanned PDFs need OCR first (the CalcPark OCR tool at /ocr, or any OCR software).
Sources: pdf.js – getTextContent API, CommonMark specification, GitHub Flavored Markdown – tables.
Questions
- Why is the output empty or only a few words?
- The PDF is probably a scan: its pages are pictures without a text layer. pdf.js can only read text that is stored as text. Run the pages through an OCR tool first (CalcPark has one at /ocr), then convert the OCR output.
- Why did a heading come out as normal text?
- Heading detection uses font size relative to the body text. A heading set in the same size as the body (only bold) is detected only when it is short (≤ 80 characters) and stands on its own line; otherwise switch to the Markdown tab and add the # yourself.
- Can it handle tables?
- Simple grids with one line per row and clear column gaps are converted to pipe tables. Tables with wrapped cells, merged headers or borders only (no gaps) are not recognised reliably; the PDF to Excel tool gives an editable grid for those.