Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>md2pdf By WebsvcPTNew to Visual Studio Code? Get it now.
md2pdf By WebsvcPT

md2pdf By WebsvcPT

Websvc

|
2 installs
| (0) | Free
Generate PDF files from Markdown documents with configurable headers and footers.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

md2pdf

md2pdf is a Visual Studio Code extension that exports Markdown documents to PDF using a local Chrome, Edge, or Chromium installation.

Features

  • Export Markdown to PDF from the Command Palette (md2pdf: Export Markdown to PDF)
  • Export Markdown to PDF from the Explorer and editor context menus
  • Front matter variables for header and footer templates
  • Default header and footer layouts with left, center, and right sections
  • GitHub-style Markdown rendering with syntax highlighted code blocks
  • Local PDF generation with no remote service dependency

Requirements

md2pdf uses puppeteer-core, so a local Chrome, Edge, or Chromium executable must be available.

If your browser is installed in a non-standard location, set md2pdf.browserExecutablePath in VS Code settings.

Install

From a local VSIX

  1. Build and package the extension.
  2. In VS Code or VS Code Insiders, open the Extensions view.
  3. Select Install from VSIX... from the ... menu.
  4. Choose the generated .vsix file.

From source for development

  1. Clone the repository.
  2. Run npm install in the project root.
  3. Press F5 in VS Code or VS Code Insiders to launch an Extension Development Host.

Usage

  1. Open a Markdown document.
  2. Run md2pdf: Export Markdown to PDF from the Command Palette, or right-click the file/editor and choose the export command.
  3. Pick the destination PDF file.

Front matter variables

Front matter values are exposed to header and footer templates. Built-in variables include:

  • {{title}}
  • {{fileName}}
  • {{fileStem}}
  • {{filePath}}
  • {{generatedAt}}
  • {{pageNumber}}
  • {{totalPages}}

Example:

---
title: Sprint Notes
author: Ada Lovelace
project: md2pdf
md2pdf:
  header:
    left: "{{project}}"
    center: "{{title}}"
    right: "Page {{pageNumber}} / {{totalPages}}"
  footer:
    left: "{{author}}"
    center: "internal"
    right: "{{generatedAt}}"
---

Configuration

Default header and footer sections are configurable in VS Code settings:

  • md2pdf.header.left
  • md2pdf.header.center
  • md2pdf.header.right
  • md2pdf.footer.left
  • md2pdf.footer.center
  • md2pdf.footer.right
  • md2pdf.page.format
  • md2pdf.page.margin.top
  • md2pdf.page.margin.right
  • md2pdf.page.margin.bottom
  • md2pdf.page.margin.left
  • md2pdf.browserExecutablePath

Development

See docs/README.md for developer setup, build, test, package, and publish instructions.

License

MIT MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft