Markdown to PDF
Markdown to PDF is an API that converts Markdown text straight into a styled PDF (typography, tables, code blocks), no HTML or CSS required. Perfect for reports or documents generated from a Notion/Obsidian note or plain text.
How it works
You send the Markdown and internally it goes through two steps: first it's converted to HTML (same engine as Markdown to HTML), then that HTML is rendered into a PDF with a clean, readable default style already built in. No design work needed on your end.
Need your own design? Use Markdown to HTML and then HTML to PDF with your own CSS.
All you need
- Your API key. Create it in your dashboard with "+ Create key". It's shown only once, so copy and save it.
- In your automation platform, an "HTTP Request" step (n8n, Make, Zapier, Pipedream… all have one).
How to use it in n8n (step by step)
In the HTTP Request node:
- Method:
POST - URL:
https://api.cofferdock.com/markdown-to-pdf - Send Headers: on → add two:
x-api-key= your key, andContent-Type=application/json - Send Body: on → Body Content Type: JSON →
{ "markdown": "# Report\n\nThis month's numbers." } - In Options → Response → Response Format: choose File
In Make: same method and URL, same JSON in the Body, and treat the response as a binary file.
Options (inside the JSON)
| Option | Default | What it does |
|---|---|---|
markdown | - | Required. The Markdown text to convert. |
format | A4 | A3, A4, A5, Letter, Legal or Tabloid. |
landscape | false | Landscape instead of portrait. |
margin | 0 | Margin in millimeters, same on all 4 sides. |
API overview
- Endpoint:
POST https://api.cofferdock.com/markdown-to-pdf - Auth: header
x-api-key: YOUR_KEY. - Input: JSON
{ "markdown": "..." }, or raw Markdown withContent-Type: text/plain. - Engine: marked (Markdown→HTML) + the same headless browser as HTML to PDF (JavaScript disabled, with anti-SSRF protection).
- Limits: 30 requests/min per IP. Up to 2MB of text. 1 call = 1 credit.
Options
| Option | Default | Description |
|---|---|---|
markdown | - | Required. |
format | A4 | A3 / A4 / A5 / Letter / Legal / Tabloid. |
landscape | false | Boolean. |
print_background | true | Prints backgrounds and colors. |
scale | 1 | 0.1 to 2. |
margin | 0 | Millimeters, 0 to 100, same on all 4 sides. |
output | pdf/json | pdf (binary), json (base64) or url (temporary link). |
Examples
curl:
curl -X POST "https://api.cofferdock.com/markdown-to-pdf" \
-H "x-api-key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"markdown":"# Report\n\nThis month'"'"'s numbers."}' \
--output report.pdf
JavaScript (Node 18+):
const r = await fetch('https://api.cofferdock.com/markdown-to-pdf', {
method: 'POST',
headers: { 'x-api-key': 'YOUR_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({ markdown: '# Report\n\nThis month\'s numbers.', output: 'pdf' }),
});
const buffer = Buffer.from(await r.arrayBuffer());
Response
{ "success": true, "pdf": "JVBERi0xLjQK...", "mime_type": "application/pdf",
"meta": { "format": "A4", "size_bytes": 8213, "used": 12, "remaining": 488 } }
What you get back
By default: with Content-Type: text/plain it returns the raw PDF binary; with JSON it returns pdf as base64. Add output=pdf to force the binary either way, or output=url for a temporary download link (valid 15 minutes).