Dokmatiq DOKMATIQ

Markdown to PDF — for reports, docs and README exports

Convert GitHub-flavoured Markdown straight into PDFs. Tables, code blocks, lists, footnotes — all with clean typography, optionally on your stationery and as PDF/A.

What it does

The API accepts a Markdown string (CommonMark or GitHub-flavoured Markdown) and returns a PDF with native typography. No HTML detour required, no bespoke templating logic — Markdown in, PDF out.

Minimal request

curl -X POST https://api.dokmatiq.com/v1/convert/markdown-to-pdf \
  -H "Authorization: Bearer $DOKMATIQ_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "markdown": "# Q1 2026 Report\n\nRevenue: **€ 1,240,000**\n\n| Region | Revenue |\n|---|---|\n| DACH | 820,000 |\n| EU | 420,000 |",
    "format": "A4",
    "theme": "default"
  }' \
  -o report.pdf

Response: Content-Type: application/pdf, status 200.

Supported Markdown features

  • Headings H1–H6 with automatic structure detection (Tagged PDF when outputProfile: "PDF/UA-1")
  • Tables (GFM) with automatic alignment
  • Fenced code blocks with syntax highlighting for 180+ languages
  • Footnotes, definition lists (extended Markdown)
  • Task lists (- [ ], - [x])
  • Inline HTML (sanitised safely)
  • Front matter (YAML) — used for metadata like title, author, date

Themes

Three built-in themes, plus a custom theme via CSS:

ThemeCharacter
defaultNeutral serif typography, for reports and documentation
technicalMonospace headings, focused on code and engineering
stationeryMinimal layout to let stationery show through
customYour own CSS file via the customCss parameter

With stationery overlay

{
  "markdown": "# Monthly Report April 2026\n\nDear Sir or Madam,\n\nplease find attached…",
  "theme": "stationery",
  "stationery": {
    "firstPage": "base64:JVBERi0xLjQ...",
    "subsequentPages": "base64:JVBERi0xLjQ..."
  },
  "contentArea": { "x": 25, "y": 60, "width": 160, "height": 200 }
}

The Markdown text flows into the defined contentArea (in millimetres), handles page breaks automatically and lands on the uploaded stationery.

What it’s used for

  • Documentation exports from MkDocs/Docusaurus/Markdown repos as printable versions
  • Quarterly reports combining structured numbers with Markdown commentary
  • Technical changelogs delivered to customers as PDF
  • Internal memos on stationery, content pulled from the wiki
  • Product READMEs turned into professional datasheets

Comparison with alternatives

Dokmatiq Markdown-to-PDFPandoc + LaTeXmd-to-pdf (Node)Markdown → HTML → Chrome
SetupAPI callinstall LaTeXNode, Puppeteertwo pipelines
Tablesnativegoodgoodgood
Syntax highlightingnativeextensiblenativebuild yourself
Stationery overlaynativecomplexnovia stationery tool
PDF/Aflag-drivenvia add-on packagesnopost-processing
ScalingAPI-sideon youon youon you

Pandoc is unbeatable for scientific documents with maths and citation styles. For business PDFs, Dokmatiq is faster and requires zero LaTeX knowledge.

Common pitfalls

  1. Tables too wide — GFM tables don’t wrap automatically; set columnWidths explicitly for long columns
  2. Code block across a page break — force break-inside: avoid on <pre> via a custom theme
  3. Umlauts inside code blocks — the embedded font must support Unicode; theme: "custom" with matching fonts helps
  4. HTML inlines sanitised aggressively — expected <script> or <iframe> elements are removed (secure default); if needed, allowUnsafeHtml: true (not recommended for untrusted input)

Try it now

100 conversions per month for free. No credit card. Stateless REST — you send, you receive.