To convert Markdown to PDF, open the .md file in an editor that exports PDF (Typora: File > Export > PDF; Obsidian on desktop: Export to PDF in the command palette; VS Code with the Markdown PDF extension) or run Pandoc: pandoc notes.md -o notes.pdf --pdf-engine=weasyprint. Without the --pdf-engine option, Pandoc needs LaTeX installed. On iPhone and iPad, use a Markdown app that prints or exports PDF, or an on-device converter.
Updated 7 November 2026. Vendor steps were read on Pandoc's, Typora's, Obsidian's and the VS Code extension's own pages on 7 November 2026. The test below was run that day with Pandoc 3.8.3, WeasyPrint 68.1 and Chrome 156 on macOS 15.6.
Why Markdown needs a converter
A .md file is plain text with formatting marks: # for headings, ** for bold, pipes for tables. A PDF is a laid-out page. Something has to render the Markdown (decide fonts, sizes, spacing) and then print it to pages. Every method below does those two steps; they differ in how much control you get over the look.
Markdown also comes in flavours. Tables, task lists and footnotes are extensions (GitHub Flavored Markdown and others). Most tools support them, but check a sample first if your file uses them.
Method 1: Pandoc (Mac, Windows, Linux)
Pandoc is a free command-line converter. Install it with Homebrew on a Mac (brew install pandoc) or the installer from pandoc.org.
The command
pandoc notes.md -o notes.pdf
Pandoc's manual says that by default it creates PDFs through LaTeX, "which requires that a LaTeX engine be installed". On a Mac without LaTeX you get: pdflatex not found. Please select a different --pdf-engine or install pdflatex.
Two ways around the LaTeX requirement
- Use an HTML engine:
pandoc notes.md -o notes.pdf --pdf-engine=weasyprint(install withbrew install weasyprint). Style it with a CSS file:--css=style.css. - Install LaTeX (MacTeX, or a small distribution such as TinyTeX) and keep the default. LaTeX gives book-quality typesetting and maths, at the cost of a large install.
Pandoc's manual also lists xelatex, lualatex, tectonic, typst, wkhtmltopdf, prince and pagedjs-cli as engines.
Our test
On 7 November 2026 we converted one Markdown file (heading, bold text, a link, a table, a code block and a list) three ways and checked each PDF with pdftotext and PyMuPDF.
| Route | Result | Table | Link clickable | File size |
|---|---|---|---|---|
pandoc --pdf-engine=weasyprint | 1-page PDF | Kept | Yes | 15.3 KB |
pandoc -s to HTML, then headless Chrome print to PDF | 1-page PDF | Kept | Yes | 41.7 KB |
pandoc notes.md -o notes.pdf (default) | Error: pdflatex not found | No PDF | ||
Both working routes kept the text selectable. WeasyPrint made the smaller file; Chrome embedded more font data.
Method 2: VS Code with the Markdown PDF extension
- In VS Code, install the extension Markdown PDF (by yzane).
- Open the .md file.
- Press F1 (or Command-Shift-P / Ctrl-Shift-P) and run Markdown PDF: Export (pdf). The same option is in the editor's right-click menu.
- Look for the PDF in the same folder as the .md file.
The extension renders with Chromium; its README says it downloads a managed Chromium automatically on first use. Users have reported export failures on macOS when that download is blocked, so allow it or point the extension at an installed Chrome.
Method 3: Typora
- Open the .md file in Typora.
- Choose File > Export > PDF.
- Pick the location and save.
Typora's documentation says PDF and HTML export do not need Pandoc. Paper size, margins and the theme used for PDF are set in Preferences > Export > PDF.
Method 4: Obsidian (desktop)
- Open the note.
- Open the command palette and choose Export to PDF.
- Choose the export options and a location, then save.
Obsidian's help says exporting to PDF is not available in the Obsidian app on mobile. Community plugins add more export styles, and some of them send your note to an outside service, so read a plugin's description before installing it.
Method 5: Print from a browser
If the Markdown is already rendered on a web page (a README on GitHub or GitLab, documentation, a notes app on the web), print that page: Command-P or Ctrl-P, then Save as PDF. On a Mac, File > Print > PDF > Save as PDF works from any app that renders the Markdown. See HTML to PDF for print tips.
How to convert Markdown to PDF on iPhone and iPad
iOS shows .md files as plain text in Files, with the marks visible. To get a formatted PDF:
- A Markdown editor app with a preview: open the file, switch to the rendered preview, then use the app's export or Print option. From the print preview, spreading two fingers on the page opens it as a PDF you can save to Files (a common shortcut, not in Apple's guide).
- Obsidian on iPhone has no PDF export, per its help page; use the print route from a rendered preview if available, or export on the desktop.
- An on-device converter that opens .md files directly; PDF Opus is the top pick (section below).
More iPhone PDF basics are in how to make a PDF on iPhone. For plain .txt files, see TXT to PDF, and for every other format, the PDF converter guide.
Limits of the common methods
- Pandoc needs a terminal and, by default, LaTeX.
- Editor exports follow the editor's theme; changing fonts or margins means editing CSS or preferences.
- Obsidian's PDF export is desktop-only.
- On iPhone, the print route gives little control over page size and margins.
Online Markdown to PDF converters
Web converters let you paste Markdown or upload a .md file and download a PDF. They are quick for a one-off, but your text goes to someone else's server. Notes, internal docs and drafts often contain names, keys or plans, so prefer a local method for anything private. See are online PDF editors safe.
Methods compared
| Method | Devices | Setup | Styling control | Batch | File leaves the device |
|---|---|---|---|---|---|
| PDF Opus (top pick) | iPhone, iPad, Mac | Open the .md file | Clean default layout | Per file | No |
| Pandoc + WeasyPrint or LaTeX | Mac, Windows, Linux | Terminal, installs | Full (CSS or LaTeX templates) | Yes, scriptable | No |
| VS Code Markdown PDF | Mac, Windows, Linux | Extension + Chromium | CSS | No | No |
| Typora | Mac, Windows, Linux | App | Themes, margins | No | No |
| Obsidian | Desktop only | App | Page size, margins, plugins | No | No |
| Online converters | Any browser | None | Little | Some | Yes |
Tips for a better PDF from Markdown
- Add a title with YAML front matter (
title: Report) so Pandoc puts it on the first page and in the PDF's metadata. - Force page breaks with print CSS (
h1 { break-before: page; }) in WeasyPrint, VS Code or Typora themes. - Keep code readable: long lines in code blocks get cut off. Wrap them in the source, or set
pre { white-space: pre-wrap; }. - Use relative image paths and run the converter from the file's folder, so images are found.
- Add a table of contents in Pandoc with
--toc. - Check maths: LaTeX engines render
$...$formulas; HTML engines need MathJax or KaTeX in the HTML step.
Troubleshooting
"pdflatex not found"
Pandoc's default PDF route needs LaTeX. Add --pdf-engine=weasyprint, or install a LaTeX distribution.
Tables come out as plain text with pipes
The renderer doesn't support Markdown tables, or the table lacks the header separator line (|---|---|). Add the separator, or use Pandoc or another tool with table support.
Images are missing
The image paths are relative to a different folder. Run the converter from the Markdown file's folder, or use full paths.
Special characters show as boxes
The chosen font lacks those characters. With Pandoc and LaTeX, use --pdf-engine=xelatex and a font that covers them; with HTML engines, set a CSS font that does.
VS Code export does nothing on Mac
The extension couldn't download or start Chromium. Check the extension's output panel, allow the download, or set the path to an installed Chrome in its settings.
PDF Opus: the best app for converting Markdown to PDF (top pick)
The best app for converting Markdown to PDF is PDF Opus. It opens .md files on your iPhone, iPad and Mac and converts them to PDF on the device, along with HTML, Word, Excel, PowerPoint, CSV, plain text and images. Right-to-left scripts are not shaped and multi-column flows are set as one column, which suits typical Markdown notes. After converting, add page numbers, a watermark or a signature, merge the PDF with other files and compress it in the same app. PDF Opus runs on its own PDF engine, written from scratch. Your documents are processed on your device. The app only goes online for purchases, licence checks (direct version) and update checks (direct version).
Frequently asked questions
How do I convert an .md file to PDF?
Open it in an editor that exports PDF (Typora, Obsidian on desktop, VS Code with Markdown PDF) or run pandoc file.md -o file.pdf --pdf-engine=weasyprint.
How do I convert Markdown to PDF on Mac?
Install Pandoc and WeasyPrint with Homebrew and run the command above, or use Typora, Obsidian or VS Code. Any app that shows the rendered Markdown can also print to PDF with File > Print > Save as PDF.
Can I convert Markdown to PDF without installing anything?
Yes, with an online converter, if you are happy to upload the text. A rendered README on GitHub can also be printed to PDF from the browser.
Can Obsidian export to PDF on iPhone?
No. Obsidian's help says PDF export is not available in its mobile app.
Why does Pandoc say pdflatex not found?
Pandoc uses LaTeX for PDF by default. Choose another engine with --pdf-engine=weasyprint or install LaTeX.
How do I keep code blocks and tables in the PDF?
Use a converter with GitHub Flavored Markdown or Pandoc support. In our test, Pandoc with WeasyPrint and the Chrome route both kept the table and the code block.
How do I style a Markdown PDF?
Pass a CSS file to Pandoc with WeasyPrint (--css=style.css), choose a theme in Typora, or edit the VS Code extension's styles setting.
Can I convert many Markdown files to PDF at once?
Yes, with a Pandoc loop in the terminal, for example for f in *.md; do pandoc "$f" -o "${f%.md}.pdf" --pdf-engine=weasyprint; done.