You can convert Markdown to PDF in four practical ways: use Pandoc from the command line, print a rendered HTML preview from your browser, export from a Markdown editor, or move the text into Google Docs and download it as a PDF. Pick the method that matches how much control you need over fonts, margins and page breaks.
Key takeaways
- Pandoc makes PDFs from Markdown but needs a PDF engine such as a LaTeX distribution or an HTML-to-PDF tool.
- The browser route (preview, then Print to PDF) needs no installs.
- Google Docs gives you a friendly layout editor before exporting.
- Check page breaks, wide tables and code blocks in the finished file.
Method 1: Convert Markdown to PDF With Pandoc
Pandoc does not draw PDF pages by itself. It converts your text and hands it to a PDF engine. The usual choice is a LaTeX distribution such as TeX Live or MiKTeX, but Pandoc can also use HTML-based engines. Once the engine is installed, the command is short:
pandoc notes.md -o notes.pdf
To pick the engine and adjust the layout, add options:
pandoc notes.md -o notes.pdf --pdf-engine=xelatex -V geometry:margin=1in -V fontsize=11pt
The XeLaTeX engine handles Unicode text and system fonts well, which helps with accented letters and non-Latin scripts. If you would rather style the page with CSS, Pandoc can use an HTML-to-PDF engine such as WeasyPrint:
pandoc notes.md -s --pdf-engine=weasyprint --css=style.css -o notes.pdf
Every option is listed in the Pandoc User’s Guide. For the Word side of the same tool, see our guide to converting Markdown to Word with Pandoc.

Method 2: Print the HTML Preview to PDF
This is the easiest option when you cannot install anything. Most Markdown editors show a rendered preview, and many can export an HTML file.
- Render your Markdown to HTML in an editor, or with a converter.
- Open the HTML in a browser such as Chrome, Edge, Firefox or Safari.
- Press Ctrl+P (Cmd+P on a Mac) to open the print dialog.
- Choose “Save as PDF” as the destination.
- Set paper size and margins, then save the file.
You can control page breaks with CSS rules such as page-break-before: always; or the newer break-before: page;. If you need the HTML step explained, read how to convert Markdown to HTML.
Method 3: Export From a Markdown Editor
Some editors include an export or print command that produces a PDF directly, and others offer it through extensions. Look in the File menu for Export. Settings are usually limited to a theme and page size, but the process takes a few clicks. If you are still choosing a tool, our comparison of the best Markdown editors notes which ones suit writers and which suit developers.
Method 4: Use Google Docs as a Layout Stage
When non-technical teammates need to adjust the layout, move the text into Google Docs first and export from there. Convert the Markdown to a DOCX with Pandoc, open it in Google Docs, adjust headers, page numbers and spacing, then choose File, Download, PDF Document. Menus may change, but this download option has long been part of Docs.
Which Method Fits Your Situation?
| Method | Install needed | Layout control | Good for |
|---|---|---|---|
| Pandoc with LaTeX | Pandoc and a LaTeX engine | High | Reports, papers, repeatable builds |
| Pandoc with CSS engine | Pandoc and WeasyPrint | High, via CSS | Styled documents |
| Browser print | None | Medium | Quick one-offs |
| Editor export | An editor | Low to medium | Notes and handouts |
| Google Docs | None | Medium, visual | Team review and polish |
Tips for a Cleaner PDF
A few habits in the Markdown source make the PDF look better with every method. Keep headings in a logical order so the table of contents makes sense. Put a blank line before and after lists, tables and code blocks. Keep image widths reasonable, because very large pictures can push content onto extra pages.
For documents you will convert repeatedly, such as weekly reports, save your command in a small script or a Makefile target and store it beside the Markdown file. That way the page size, fonts and margins never drift from one run to the next. If you publish from a repository, the approach pairs well with the ideas in our docs-as-code workflow guide.
Fix Common PDF Problems
- “pdflatex not found” or a similar error: install a LaTeX distribution or switch to another engine.
- Missing characters: use
--pdf-engine=xelatexand a font that contains the glyphs. - Code lines cut off: shorten lines or choose a smaller font for code blocks.
- Wide tables overflow: shorten column text, or print in landscape.
- Images missing: run the command from the folder that makes your relative paths valid.

Frequently Asked Questions
Why does Pandoc ask for LaTeX?
Its default PDF route uses LaTeX to typeset pages. You can choose an HTML-based engine with the --pdf-engine option instead.
What is the quickest way with no installs?
Preview the Markdown as HTML in a browser and use Print, then Save as PDF.
Can I add a table of contents?
Yes. With Pandoc, add --toc to the command.
Will links stay clickable?
In most workflows, yes. Pandoc and browser printing generally keep hyperlinks active in the PDF, but check the result in your reader.
How do I make the PDF look more polished?
Use a CSS stylesheet with an HTML-based engine, or edit the layout in Google Docs before downloading the PDF.
Wrap-Up
Start with the browser print method if you just need a file today. Move to Pandoc when you want repeatable, well-styled output, and use Google Docs when teammates need to tweak the layout before it goes out.



