Markdown to PDF in VS Code: Extensions, Steps, and Known Issues

Aug 17, 2026
ByPDFtoMD

VS Code’s Markdown engine is a great tool for documentation. But how can you convert it to a printable document? That’s where extensions like yzane Markdown PDF or the Markdown to PDF Export extension by Shahil Kumar come in.

Both are free options, but there are differences between them that matter if you’re looking to print code-heavy documents.

The Markdown PDF extension uses the Chromium engine, which exports a PDF (and optionally HTML, PNG, or JPEG). The other extension relies on markdown-it for parsing the file, along with highlight.js for syntax highlighting, and Puppeteer for creating the PDF itself. It supports syntax highlighting, images, tables, and GitHub-style formatting.

The Markdown to PDF Export by Shahil Kumar extension has 3,667 installs and supports syntax highlighting/images/tables/GitHub-style formatting. Simply right-click on an open .md file and select “Markdown PDF: export” to convert it. Output goes to the same directory as your source file, with the same name. You can customize where the output lands in the extension settings.

yzane Markdown PDF

While both methods work well, I’ve only tested one of them for my own use. This one stands out for two reasons. One, because I’m working mostly with code, I wanted to preserve the syntax highlighting. Two, long lines of code sometimes overflow the page width. In this case, I’d prefer the line to wrap instead of scroll horizontally. Both methods do something similar. Unfortunately, the alternative methods don’t seem to have either option.

I should mention that there is one issue when using WSL Remote within VS Code, specifically with the yzane Markdown PDF extension.

The error occurs when trying to run the ‘export’ command:

ERROR: exportPdf()

Error: Failed to launch chrome!

FATAL zygote_host_impl_linux.cc No usable sandbox!

In this scenario, I would suggest updating your kernel, following Chromium’s SUID sandbox development documentation, or simply filing an issue against yzane/vscode-markdown-pdf (1.3k stars, 264 forks). It’s already closed under milestone 1.4.3.

Customization

There are several ways to customize these extensions. You can turn off headers and footers in their settings.

With the Markdown PDF extension, open the Command Palette with F1 or Ctrl+Shift+P (Cmd+Shift+P on Mac) to bring up the export menu. Alternatively, right-click an open .md file and choose “Markdown PDF: export.” By default, output goes into the same directory as your source file, with the same name. But that setting is configurable.

You’ll find additional styling themes and custom CSS support planned as part of the Markdown to PDF Export project’s open contribution areas. A table of contents generator could be added as well.