default
A neutral sans-serif document style at 11 pt, with ruled second-level headings. Good for reports, exports and anything that should simply look tidy.
Markdown to PDF API
Send Markdown and get a clean, branded PDF back, with tables, footnotes and your own theme. Built for docs, reports and the Markdown your AI features already produce.
A Markdown to PDF API converts Markdown text into a formatted PDF. You send the Markdown in an HTTP request; the service turns it into HTML, applies a print stylesheet with fonts, margins and page numbers, renders it in a browser engine and returns the PDF. You get a styled document without writing HTML or running a converter yourself.
| Endpoint | POST https://api.dynamicdocumentapi.com/v1/pdf/from-markdown |
|---|---|
| Markdown | CommonMark plus tables, strikethrough, task lists, autolinks and footnotes |
| Themes | default, github, academic, minimal, or none with your own CSS |
| Variables | Jinja templating on the Markdown when you send data |
| Raw HTML | Off by default (allow_raw_html); output is always sanitized |
| Rendering engine | Engine 2026.4 on Chromium (Chrome 153), same print options as HTML to PDF |
| Price | Free: 50 renders/month. Paid from €15/month (billed annually) for 3,000 renders, auto top-ups from €6 per 1,000 |
Send the Markdown as a string, pick a theme, and optionally add CSS. Print settings
such as paper size, margins and a page-number footer go into pdf, exactly
as on the HTML to PDF API.
curl https://api.dynamicdocumentapi.com/v1/pdf/from-markdown \
-H "Authorization: Bearer $DYNAMIC_DOCUMENT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"markdown": "# Q3 report\n\nRevenue grew **18%**.\n\n| Region | Q3 |\n|---|---|\n| US | 492 |",
"theme": "github",
"css": "h1 { color: #4751e9; }",
"pdf": {
"paper": { "size": "Letter" },
"footer": { "enabled": true, "right": "Page {{page}} of {{pages}}" }
},
"delivery": "binary"
}' \
--output report.pdf
// Node.js 18+: turn a Markdown file into a PDF
import { readFile, writeFile } from "node:fs/promises";
const markdown = await readFile("README.md", "utf8");
const res = await fetch("https://api.dynamicdocumentapi.com/v1/pdf/from-markdown", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.DYNAMIC_DOCUMENT_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ markdown, theme: "github", delivery: "binary" }),
});
await writeFile("README.pdf", Buffer.from(await res.arrayBuffer()));
import os
import pathlib
import requests
markdown = pathlib.Path("README.md").read_text()
res = requests.post(
"https://api.dynamicdocumentapi.com/v1/pdf/from-markdown",
headers={"Authorization": f"Bearer {os.environ['DYNAMIC_DOCUMENT_API_KEY']}"},
json={"markdown": markdown, "theme": "github", "delivery": "binary"},
timeout=60,
)
res.raise_for_status()
pathlib.Path("README.pdf").write_bytes(res.content)
<?php
$markdown = file_get_contents('README.md');
$ch = curl_init('https://api.dynamicdocumentapi.com/v1/pdf/from-markdown');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('DYNAMIC_DOCUMENT_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'markdown' => $markdown,
'theme' => 'github',
'delivery' => 'binary',
]),
]);
file_put_contents('README.pdf', curl_exec($ch));
| Field | What it does |
|---|---|
markdown | Required. The Markdown text. |
theme | default, github, academic, minimal or none. |
css | Extra CSS on top of the theme, or the whole stylesheet with none. |
data | JSON values for {{ variables }} in the Markdown. |
templating | Run Jinja on the Markdown. On automatically when data is sent. |
allow_raw_html | Keep HTML tags written inside the Markdown. Default false; output is sanitized either way. |
pdf | Paper, margins, header and footer, page numbers, bookmarks, metadata. |
delivery | url (default, signed link), binary or base64. |
The parser follows CommonMark, the specification behind GitHub, GitLab and most editors, and adds the GitHub-style extensions people use in real documents. We list what is not built in as well, so you know before you start.
| Syntax | Supported |
|---|---|
| Headings, paragraphs, emphasis, lists, block quotes, links, images | Yes (CommonMark) |
| Tables with column alignment | Yes |
Task lists - [x] | Yes |
Strikethrough ~~text~~ | Yes |
Footnotes [^1] | Yes |
| Automatic links for bare URLs | Yes |
| Heading anchors for links and PDF bookmarks | Yes, plus bookmarks with pdf.outline |
| Fenced code blocks | Yes, monospaced, without color highlighting |
| Math (LaTeX), Mermaid diagrams | Not built in; render them as images first |
| Raw HTML | Only with allow_raw_html, sanitized |
Themes are print stylesheets tuned for paper: readable line lengths, sensible heading sizes, tables that do not overflow the page, and margins that work on A4 and Letter.
A neutral sans-serif document style at 11 pt, with ruled second-level headings. Good for reports, exports and anything that should simply look tidy.
Looks like a rendered README on a code-hosting site. Suits developer docs, changelogs and technical notes.
Serif type, justified text with hyphenation, wider margins, and automatically numbered sections (1., 1.1, 1.2). Made for papers, research summaries and long reports.
Compact and monochrome at 10 pt, with plenty of white space and uppercase section headings. For letters, memos and internal documents.
Add brand colors and fonts with css, or set theme to
none and write the full stylesheet. For a layout with a cover page, logo
and legal footer around the Markdown, wrap it in a branded
template: Markdown templates are stored and versioned like HTML templates, and the
markdown filter drops Markdown into any HTML template.
Language models answer in Markdown: headings, bullet lists, tables and bold text. That makes Markdown to PDF the shortest path from an AI feature to a document a customer can download, print or file: a generated report, a meeting summary, a proposal draft, a research brief.
markdown.data and reference them as {{ variables }}, so
the model writes the prose and your system supplies the facts.Documentation already lives in Markdown. Generate a PDF handbook from the same files on
every release, attach a PDF version of a README to a download, or let users export a
knowledge-base article. Use pdf.outline to turn headings into PDF
bookmarks, and a CSS rule such as h1 { break-before: page; } to start
each chapter on a new page.
Markdown is one of four inputs of our PDF generation API. Need a layout Markdown cannot express, such as multi-column pages or a pixel-exact form? Write HTML instead, with the same engine and options.
See all plans for larger volumes.
FAQ
CommonMark with the GitHub-style extensions tables, strikethrough, task lists, autolinks and footnotes. Headings get anchor IDs automatically. Syntax highlighting, math and Mermaid diagrams are not built in.
Yes. Pick one of the themes and add rules in css, or set
theme to none and bring the complete stylesheet. Print
features such as @page margins, page breaks and web fonts work as in any
HTML document.
Code blocks render in a monospaced font with the theme's styling, but without colored syntax highlighting. If you need colors, highlight the code on your side, for example with highlight.js or Pygments, and send the resulting HTML to the HTML to PDF endpoint.
Yes. Language models write Markdown by default, so their answers can be sent as they are. Raw HTML inside the Markdown is removed unless you turn it on, which protects the PDF from markup the model was tricked into writing.
Only if you set allow_raw_html to true. It is off by
default, and even when it is on, the output is sanitized: scripts and other active
content are removed. Markdown templates stored in your account always keep raw HTML
off.
Yes. Send data with the request and the Markdown is processed as a Jinja
template first, so {{ customer }} or a {% for %} loop work
just like in HTML templates.
50 renders a month on the free plan, no credit card, auto top-ups on paid plans.
Start free