/// GUIDES

Markdown to PDF — Convert MD Files via API

Convert Markdown to PDF with one REST call: styling, page breaks, code blocks and tables handled. Why devs are ditching pandoc setups. Free tier.

Document automation engineers, ASHDOCS
Published:
Last updated:

Markdown is where documentation lives; PDF is where it gets sent. README files, release notes, internal runbooks, contracts drafted in plain text — sooner or later someone asks for "a PDF version," and the gap between those two formats is wider than it looks.

Why is Markdown to PDF suddenly a thing?

Two reasons. First, Markdown won: it's the default format of developer documentation, AI-generated content, and note tools from Obsidian to Notion. Second, LLMs write Markdown natively — which means teams now produce far more .md content than ever, and far more of it needs to become a shareable, printable document.

The classic options (and where they hurt)

Pandoc. The venerable converter handles Markdown to PDF via a LaTeX toolchain. It's powerful and free, but the toolchain is heavy — a full TeX install runs to gigabytes — and styling means learning LaTeX templates. Great for academic papers; overkill for an invoice or a runbook.

npm packages (md-to-pdf and friends). These wrap headless Chrome: your Markdown becomes HTML, a browser prints it. Works well locally, but now your production server hosts a Chromium instance — with the memory footprint, cold starts and security patching that implies.

Print from the editor. Fine once; useless in a pipeline.

The pattern in all three: conversion is easy, operating the converter is the cost.

Doing it with one REST call

An API moves the browser problem to someone else's infrastructure:

curl -X POST https://www.ashdocs.com/api/v1/tools/markdown-to-pdf \
  -H "X-API-Key: ash_live_..." \
  -F "files=@release-notes.md" \
  -F 'options={"format":"A4"}'

You send Markdown, you receive a PDF. Headings, nested lists, tables, fenced code blocks with syntax highlighting, and images all survive. Because rendering happens through the same engine as our HTML to PDF API, anything you can style with CSS you can style in the output — inject a stylesheet for brand fonts and headers.

What to watch when converting Markdown

Page breaks. Markdown has no concept of pages. Long tables and code blocks need break rules — page-break-inside: avoid on <table> and <pre> fixes the ugliest cases.

Code blocks. Line-wrap or scroll? PDFs can't scroll. Wrap long lines or shrink the font per-block.

Front matter. YAML front matter should be stripped or rendered as a title block, not printed raw.

Relative image paths. A local ./img/diagram.png reference resolves on your machine, not on a server. Inline images as data URIs or use absolute URLs.

From automation platforms

The same endpoint works from a Make HTTP module, a Zapier webhook action, or an n8n HTTP Request node: point the module at the endpoint, attach the file, map the binary response to your storage step. A "new file in Google Drive → convert → email the PDF" flow needs no code at all.

FAQ

Can I convert Markdown to PDF without installing anything? Yes — send the file to a conversion API via curl or any HTTP client. No pandoc, LaTeX or headless browser install is needed; the rendering happens server-side.

Does the conversion keep code syntax highlighting? Yes. Fenced code blocks are rendered with highlighting before printing, so the PDF shows what your editor shows.

How do tables come out? Standard pipe tables render as proper bordered tables. Very wide tables should be rotated to landscape via the format option or restructured — a PDF page is narrower than a browser window.

Is there a free tier? Yes — 100 credits per month, no card required, and sandbox keys never consume credits.

Ship your first Markdown to PDF conversion in five minutes — start free with 100 credits.