How to convert Markdown to PDF on a Mac
The fastest way to convert Markdown to PDF on a Mac is to export a self-contained HTML page from your editor and print it to PDF — in Constly, Export HTML… (⌘⇧E), then open the page and print it to PDF. For automation or precise typesetting, use Pandoc on the command line. For a quick one-off, print to PDF from any preview. Here’s each method and when to reach for it.
Method 1 — Export to HTML, then print to PDF (most faithful)
If you’re already writing in a Markdown editor, the cleanest in-app route is a self-contained HTML export, then print that to PDF. In Constly:
- Open your
.mdfile. - File → Export HTML… (or ⌘⇧E) and save the page.
- Open the exported
.htmlin your browser, then File → Print → Save as PDF.
Constly bakes everything into that single HTML file — your KaTeX math, Mermaid diagrams, highlighted code blocks and images — so the printed PDF keeps it all, with no watermark. (Most Markdown editors offer a comparable export; the labels differ, but the idea is the same.)
Best for: the everyday case — a document you’re already editing and want as a clean, faithful PDF.
Method 2 — Pandoc (best for automation and typesetting)
Pandoc is the command-line workhorse for converting between document formats, and it gives you the most control. You’ll install Pandoc plus a PDF engine (LaTeX is the usual choice).
# Install Pandoc and a lightweight LaTeX engine via Homebrew
brew install pandoc
brew install --cask basictex # smaller than full MacTeX
# Restart your terminal so the LaTeX tools are on your PATH, then:
pandoc notes.md -o notes.pdf
A few useful flags:
pandoc notes.md -o notes.pdf --toc # add a table of contents
pandoc notes.md -o notes.pdf -V geometry:margin=1in # set margins
If a build complains about a missing LaTeX package, install it with sudo tlmgr install <package>. It’s more setup than a menu click, but once it works you can convert dozens of files in a script — ideal for repeatable, well-typeset output.
Best for: batch conversion, CI pipelines, and anyone who wants fine control over the typography.
Method 3 — Print to PDF (quickest one-off)
macOS can save any printable view as a PDF, no tools required:
- Open the rendered Markdown — your editor’s preview, or a browser if you’ve got an HTML version.
- File → Print (⌘P).
- In the print dialog, click the PDF dropdown (bottom-left) → Save as PDF.
It’s instant, but you’re at the mercy of whatever stylesheet the preview uses, so the layout is less predictable than the other two methods.
Best for: a single quick export when you don’t need it to look perfect.
Which method should you use?
| Method | Setup | Control | Best for |
|---|---|---|---|
| Constly: HTML → print | None | Good | Everyday, faithful PDFs |
| Pandoc | One-time install | Highest | Automation, precise typesetting |
| Print to PDF | None | Low | Fast one-offs |
For most people, Constly’s HTML export plus a quick print is the sweet spot — no terminal, no LaTeX, and the result looks like the document you were just writing. If that’s you, Constly is free to download. If you’re a fan of free Markdown tools generally, here’s our list of the best free Markdown editors for Mac.