Markdown → PDF

One call from model-generated Markdown to a shareable PDF.

POST /api/v1/markdown-to-pdf MCP markdown_to_pdf convertbrowser

Boots a headless browser: ~2–5s.

Playground

Markdown source. In slides layout, --- separates one slide from the next.
report protects headings, tables and code blocks from being split. slides cuts the Markdown at every --- and gives each chunk its own page. continuous emits one tall page. flow is raw Chromium pagination.
Start each section on a fresh page. report layout only. The first section never gets a break, so you never get a blank opening page.
Paper size.
Page geometry for slides layout.
Built-in stylesheet.
Document title, also available to header/footer templates.
Advanced options (8)
Download filename.
HTML for the running footer.
HTML for the running header. Supports Chromium's .title, .date, .pageNumber, .totalPages classes.
CSS length applied to all four margins, or four space-separated lengths (top right bottom left).
Pages to keep, e.g. 1-3,8. Empty means all pages.
Render scale, 0.1–2.
Runs against this deployment's live API.

Result

Fill in the form and hit Run.

Call it from code

How it works

Composes markdown-to-html and html-to-pdf so agents don't have to chain two calls and shuttle a large HTML blob through their context window.

The print theme uses a serif body, tighter margins and page-break rules tuned for paper; clean matches the on-screen look.

Reports

The default layout: "report" applies the same typesetting rules as html-to-pdf: headings stay attached to the text below them, tables and code blocks are never sliced, and <thead> repeats when a long table does have to span pages. Add sectionBreak: "h1" to start every top-level section on a fresh sheet, or layout: "continuous" for a single unbroken page.

Slide decks

With layout: "slides" the Markdown is cut at every horizontal rule (---, *** or ___) and each chunk becomes exactly one PDF page at the chosen aspect ratio. A chunk containing nothing but a heading is centred as a section divider. Content is clipped rather than reflowed, so a slide is never split across two pages — if a slide looks cut off, it has too much on it.

# Quarterly Review
Q3 2026

---

## Highlights

- Revenue up 12%
- Churn down to 1.8%

---

## Next quarter
Tips
  • slides clips overflow rather than reflowing it — that is what guarantees one slide per page. Split a crowded slide with another ---.
  • sectionBreak never fires on the first heading, so you will not get a blank opening page.

Parameters

ParameterTypeDefaultDescription
markdown * string Markdown source. In slides layout, --- separates one slide from the next.
layout `report` | `slides` | `continuous` | `flow` "report" report protects headings, tables and code blocks from being split. slides cuts the Markdown at every --- and gives each chunk its own page. continuous emits one tall page. flow is raw Chromium pagination.
sectionBreak `none` | `h1` | `h2` | `h3` | `section` "none" Start each section on a fresh page. report layout only. The first section never gets a break, so you never get a blank opening page.
slideSize `16:9` | `16:10` | `4:3` | `a4-landscape` "16:9" Page geometry for slides layout.
theme `clean` | `github` | `print` | `minimal` | `none` "print" Built-in stylesheet.
title string Document title, also available to header/footer templates.
toc boolean false Prepend a table of contents. Ignored in slides layout.
format `A4` | `A3` | `A5` | `Letter` | `Legal` | `Tabloid` "A4" Paper size.
landscape boolean false Landscape orientation.
printBackground boolean true Render CSS backgrounds and images. Off by default in Chromium; on by default here.
scale number 1 Render scale, 0.1–2.
margin string "16mm" CSS length applied to all four margins, or four space-separated lengths (top right bottom left).
pageRanges string Pages to keep, e.g. 1-3,8. Empty means all pages.
displayHeaderFooter boolean false Show the header/footer templates.
headerTemplate string HTML for the running header. Supports Chromium's .title, .date, .pageNumber, .totalPages classes.
footerTemplate string HTML for the running footer.
filename string "document.pdf" Download filename.

Response

The PDF bytes. With `?output=json` the descriptor also reports `layout`, `pages` and — for decks — `slides`.

Pairs well with