5 Ways to Convert Markdown to PDF Compared (Pandoc, VSCode, Online Tools)
Compare five Markdown-to-PDF methods with a shared test document, then choose browser batch, editor export, local CLI, or Pandoc.
On this page
01Short answer first02Method 3 — VSCode "Markdown PDF" extension03FAQFor a one-off document, the browser-based /markdown-to-pdf has the least setup. Pandoc is stronger for citations and publishing pipelines; VS Code and CLI options fit editor-centric or automated work. The right choice depends on document features, repeatability, and local-control requirements.
This comparison uses current documented capabilities rather than fixed stopwatch or download-size claims, because setup time and bundled browser size vary by operating system and release.
Best for: One-off conversion, code highlighting, math, diagrams, no install.
How: Open /markdown-to-pdf, paste, click PDF.
Setup and first run: Varies by operating system, installed PDF engine, cache state, and document complexity; test on your own environment.
Pros: No local installation; code highlighting, KaTeX, Mermaid, tables, images, and task lists are supported. Sign in for five clean browser exports in total, followed by unlimited watermarked exports. Creator is 1 pass covers one clean browser export. API credits are separate.
Scope: The individual PDF page has a 1 MB input cap. For several files, the separate paid Batch export tool creates a ZIP of separate outputs. See the batch guide for its limits and combined-PDF alternatives.
When to use: most of one-off Markdown → PDF conversions.
Best for: Academic papers, custom LaTeX templates, citations and references, multi-format output (PDF + DOCX + EPUB from one source).
How:
brew install pandoc
brew install --cask basictex # or mactex (platform-dependent)
pandoc input.md -o output.pdf
Pros: Battle-tested, scriptable, infinite templating via LaTeX. Handles citations natively (--bibliography). Runs offline. True book-quality typography.
Cons: Requires a PDF engine, fonts, and template configuration. Use --syntax-highlighting to select a syntax theme explicitly; verify the result with the chosen engine. Prepare Mermaid diagrams as images or configure a suitable preprocessing workflow.
When to use: You're publishing a book, thesis, paper with bibliography, or you maintain three or more PDF templates that you want under version control.
Best for: People who write Markdown inside VSCode all day.
How: Install the "Markdown PDF" extension by yzane, right-click the file → Markdown PDF: Export (pdf).
Pros: Export from the editor with configurable CSS and code highlighting. The current README documents Mermaid and KaTeX support; check your installed version and configuration.
Cons: The extension needs a compatible browser runtime, and its settings and CSS determine the result. Do not assume an editor preview extension is also active in PDF export; test math, Mermaid, fonts, and page breaks in the downloaded PDF.
When to use: You already write and review the source in VS Code and want export settings next to that workflow.
Best for: Markdown that's already rendered in a browser (GitHub README, GitLab Wiki, rendered docs site).
How: ⌘+P or Ctrl+P → "Save as PDF".
Pros: Already there. No install. Works on any rendered HTML.
Cons: Output depends on the source page’s print CSS and your print settings. Check backgrounds, token colors, headers, footers, and page breaks. Math and diagrams must already be rendered on the page.
When to use: You need a PDF right now of an already-rendered Markdown page and the rough edges don't matter.
Best for: Build pipelines, CI/CD, automated docs.
How:
npm install -g md-to-pdf
md-to-pdf input.md
Pros: Scriptable. YAML front-matter for per-document theming. Watch mode for live preview. Works offline once installed.
Cons: Requires Node.js and a browser runtime. Customization uses configuration and CSS. Confirm support for your Markdown extensions; when a diagram is not rendered, prepare it as an image before conversion.
When to use: Your docs site builds PDFs in CI; you want PDFs in version control alongside source.
Use the exact package name from the linked documentation. md-to-pdf and markdown-pdf are different packages; check the chosen release and its advisories before installing.
| Method | Local setup | First export | Highlights | Math | Mermaid | Best fit |
|---|---|---|---|---|---|---|
/markdown-to-pdf | None | Browser request | Supported | KaTeX | Supported | Individual documents |
| Pandoc | PDF engine and fonts | Environment-dependent | Syntax themes | Engine-dependent | Preprocess | Books and citations |
| VS Code Markdown PDF | Extension and renderer | Environment-dependent | Configurable | KaTeX | Supported; configure runtime | Editor workflow |
| Browser print | Rendered source page | Print dialog | Source-dependent | Source-dependent | Source-dependent | Existing web pages |
md-to-pdf CLI | Node.js and browser runtime | Environment-dependent | Configurable | Check configuration | Prepare images | CI builds |
- Most readers →
/markdown-to-pdf. It is the answer for most of cases. - Academics with citations → Pandoc.
- Daily VSCode users → the VSCode plugin.
- DocOps / CI builds →
md-to-pdfCLI. - GitHub README right now → browser print, accept the rough edges.
Choose automation when the document must rebuild on a schedule or commit. For an occasional group of files, browser batch avoids local setup. Pandoc fits a different need: one ordered document with publishing structure, citations, and a controlled template.
Which method best preserves code highlighting?
Chromium-based methods can preserve web-style highlighting when their theme and print settings are aligned. Pandoc uses its own syntax-theme settings. Compare your exact code fixture rather than assuming themes transfer unchanged. See the code-highlighting guide.
Can any of these batch convert multiple files?
For several files, open Batch export: this paid tool accepts up to 15 Markdown files per run and downloads a ZIP with one output per input. Creator includes 20 runs per month. Select PDF for separate PDFs; use Pandoc when you need one combined document.
Why not markdown-pdf instead of md-to-pdf?
This guide uses md-to-pdf, linked above. Package names are not interchangeable; compare the documentation, release status, and security advisories for any alternative you choose.
Which method handles Chinese / CJK fonts best?
The hosted /markdown-to-pdf renderer uses its server-side font environment. Local Chromium tools use fonts available in their runtime, while Pandoc with XeLaTeX normally needs an explicit CJK font such as mainfont:. Always test the exact characters you publish.
Which one is cheapest to run at scale?
Compare total operating cost: browser export plan, API credits if used, CI compute, fonts, and template maintenance. A Creator browser subscription does not include API render credits. Choose from measured usage rather than a universal weekly-volume threshold.
Choose by the artifact: an individual document in the browser, a ZIP from browser batch, recurring builds in CI, or one citation-rich document with Pandoc. Run the same fixture through your shortlisted methods and inspect their actual PDFs.
# Document export test
## Handoff checklist
- [x] Headings
- [x] Table layout
- [x] Code formatting
| Check | Expected result |
|:--|:--|
| Body text | Readable at page width |
| Links | Retained in PDF |
> Demo content for comparing export methods.
Use this demonstration fixture in each method you are considering. The shown export is a product example, not a measured benchmark of all five tools. Check table borders, task markers, and text selection in each downloaded PDF before choosing a workflow.
The product limits and commands above were checked against these current primary sources:
Open MarkdownToImage to render Markdown, then choose the output format that matches your workflow. Test one representative document before automating a batch.