Markdown to PDF: 3 Ways to Convert .md Files

Need to hand in a report, send a document to a client or print your notes? Converting Markdown to PDF is the most common next step. Here are three ways, from "open a web page" to "batch convert from the command line".

The fastest way: open your .md file in Moread, click Print / save as PDF in the toolbar and choose Save as PDF.

Best for most people: nothing to install, and diagrams and formulas are preserved.

  1. Open Moread and drag in your .md file. If it references images, use Open folder instead.
  2. Click Print / save as PDF (the download icon) in the top-right toolbar.
  3. In the print dialog, set the destination to Save as PDF and click Save.

Recommended print settings:

Setting Value Why
Paper size A4 or Letter Moread's print layout fits both
Margins Default Moread already adds 16 mm margins
Headers and footers Off Avoids printing the URL and date
Background graphics On Keeps code block and table shading

When exporting, Moread automatically:

  • Switches Mermaid diagrams and LaTeX math to print-friendly light colors.
  • Hides the sidebar, outline and toolbar so only the content is printed.
  • Avoids leaving headings at the bottom of a page and splitting code blocks or table rows.

No file, just text? Paste it into the online Markdown editor and save it as a PDF the same way.

Method 2: Visual Studio Code

If you already write Markdown in VS Code:

  1. Install the Markdown PDF extension.
  2. Open the .md file, press Ctrl + Shift + P and run Markdown PDF: Export (pdf).
  3. The PDF is saved next to the source file.

The downside: Mermaid diagrams and math need extra configuration.

Method 3: Pandoc (great for batch conversion)

Pandoc is a professional document converter, ideal for developers or for converting many files. After installing Pandoc and a LaTeX engine (MiKTeX or TeX Live), run:

pandoc input.md -o output.pdf --pdf-engine=xelatex
  • Use --pdf-engine=xelatex for reliable Unicode support.
  • For CJK text, add a font, for example -V CJKmainfont="Noto Sans CJK SC".
  • Mermaid diagrams require an extra filter and more setup.

Comparison

Moread VS Code Pandoc
Install needed No Yes Yes (plus LaTeX)
Mermaid diagrams Yes Needs setup Needs a filter
Math Yes Needs setup Yes
Batch conversion No No Yes

Common questions

Images are missing from the PDF

In Moread, use Open folder so the images are loaded together with the .md file. A single opened file can't reach the images next to it.

Can I control page breaks?

Moread avoids awkward breaks automatically. To force a break somewhere specific, split the document into two files and export them separately.

Can I convert to PDF on my phone?

Yes. Open Moread in your phone's browser and tap Print / save as PDF. On iPhone, choose Print from the share sheet and save as PDF; on Android, pick Save as PDF as the printer. See how to open MD files on your phone.

What about Word?

Save as PDF first and open the PDF in Word to convert it, or use Pandoc: pandoc input.md -o output.docx.