Markdown to PDF API
Send Markdown in a POST request to /api/export-pdf and the response is the PDF — the same engine as the editor, with page numbers, themes and A4 or Letter. There is no API key: the endpoint is free, with a fair-use limit of 20 requests a minute per address.
Make a request
curl -X POST https://cropmark.app/api/export-pdf \
-H "Content-Type: application/json" \
-d '{"markdown": "# Report\n\nHello.", "options": {"paper": "a4"}}' \
-o report.pdf$body = @{ markdown = "# Report`n`nHello."; options = @{ paper = "letter" } } | ConvertTo-Json
Invoke-WebRequest -Uri https://cropmark.app/api/export-pdf -Method Post `
-ContentType "application/json; charset=utf-8" `
-Body ([Text.Encoding]::UTF8.GetBytes($body)) -OutFile report.pdfimport { writeFile } from 'node:fs/promises';
const response = await fetch('https://cropmark.app/api/export-pdf', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ markdown: '# Report\n\nHello.', options: { theme: 'minimal' } }),
});
if (!response.ok) throw new Error((await response.json()).message);
await writeFile('report.pdf', Buffer.from(await response.arrayBuffer()));Options
Every option is optional; the defaults are shown.
| Field | Values | Default |
|---|---|---|
theme | elegant, minimal, technical | elegant |
paper | a4, letter | a4 |
margin | narrow, normal, wide | normal |
pageNumbers | true, false | true |
headerText | Up to 200 characters | The document title |
footerText | Up to 200 characters | None |
Responses
| Status | Meaning |
|---|---|
200 | The PDF, as application/pdf, named from the document title |
400 | Missing markdown, or an option outside the values above |
413 | More than 2 MB of Markdown |
429 | Over the per-minute limit; the Retry-After header says when to retry |
503 | The server is busy; retry after the Retry-After delay |
504 | The document took too long to render |
Errors are JSON: { "error": "…", "message": "…" }.
Questions
Do I need an API key?
No. The endpoint is open, limited to 20 requests a minute per address.
Can I call it from a web page on another site?
Not directly: it sends no CORS headers. Call it from a server or a script.
Is the API stable?
It is public but not versioned yet. Fields may be added; breaking changes will be announced on this page first.
Are documents sent to the API stored?
No. They are rendered in memory and discarded, like documents from the editor.
Try it on your own document
Paste your Markdown, check the page, download the PDF. Free, with no sign-up.
See also
Published . Updated .