pdf2md API
PDF to Markdown. Version 0.1.0, parser pdf-inspector 1.17.0.
This instance is open: no API key is required.
Everything is parsed in process by a WebAssembly module. Uploads are held in memory for the length of the request and are never written to disk or sent anywhere else.
Convert
curl -X POST https://pdf2md-api.dudko.dev/api/v1/convert \
-F [email protected] \
-F profile=compact
Returns text/markdown. Add ?format=json for the full
result — page count, detected type, layout, which pages would need OCR.
The body may also be a raw application/pdf, or JSON
{"pdf": "<base64>", "options": {…}}. Options work as query
parameters in every case.
Detect
curl -X POST https://pdf2md-api.dudko.dev/api/v1/detect --data-binary @report.pdf
Classification only, in milliseconds: is this text, a scan or a mix, how many pages, and which of them would need OCR. Use it to route work before paying for a conversion.
Plain text
curl -X POST https://pdf2md-api.dudko.dev/api/v1/text --data-binary @report.pdf
Options
| Option | Meaning |
|---|---|
pages | 1-indexed selection: 1,3,5-7 |
password | for an encrypted document |
profile | fidelity (default) or compact, which spends fewer tokens |
includePageMarkers | insert <!-- Page N --> between pages |
includeImages, includeLinks | emit image placeholders / extracted hyperlinks |
stripHeadersFooters | drop running headers and footers |
detectHeaders, detectLists, detectCode, detectBold, detectItalic, detectUnderline | turn individual detectors off with =false |
removePageNumbers, formatUrls, fixHyphenation | post-processing, all on by default |
baseFontSize | body text size in points, when the heuristic gets it wrong |
GET /api/v1/options returns the same list as JSON, plus this
instance's limits.
Response headers
| Header | Meaning |
|---|---|
X-Pdf-Type | TextBased, Scanned, ImageBased or Mixed |
X-Pdf-Pages | page count |
X-Pdf-Needs-Ocr | comma-separated 1-indexed pages, empty when none |
X-Pdf-Encoding-Issues | true when the text is probably garbled |
X-Pdf-Ms | conversion time |
Status codes
401 | missing or wrong API key, or the wrong password for an encrypted PDF |
413 | larger than 32 MB |
415 | not a PDF |
422 | a PDF, but nothing could be extracted — a scan, usually |
429 | rate limit or daily quota |
503 | the queue is full; retry shortly |
504 | the conversion hit the deadline |
This is not OCR
A scanned document is reported as Scanned with no Markdown and a
422 from /convert. Run it through an OCR tool first. Watch
X-Pdf-Encoding-Issues as well: text came out, but the fonts declare
an encoding the bytes do not honour, so the characters are probably wrong.
Doing it yourself
The same conversion runs in a browser and in Node with no server at all —
npm i @dudko.dev/pdf-to-md-core, or npx @dudko.dev/pdf-to-md-cli file.pdf.
The web app at pdf2md.dudko.dev never
calls this API: it runs the same module in the visitor's browser.