md-tech-pdf for Visual Studio Code
Export Markdown documents with embedded Mermaid and PlantUML diagrams into clean, high-quality technical PDFs directly inside Visual Studio Code.
Overview
md-tech-pdf is a technical document PDF exporter built specifically for software engineering documents, architecture design records, system specifications, and documentation pipelines.
It renders vector diagrams cleanly, applies modern typography optimized for technical documentation, and provides seamless export actions within VS Code.
A standalone command-line interface (CLI) is also available in the repository for automated CI/CD documentation builds.
Features
- Live Print-Preview: Real-time side-by-side preview matching actual PDF paper dimensions, custom margins, and typography.
- Fast In-Memory Diagram Cache: Sub-10ms warm re-rendering for documents with complex Mermaid and PlantUML diagrams.
- Direct PDF Export: Convert Markdown files to PDF with a single command.
- Save As Dialog: Choose a customized output directory and filename interactively.
- Explorer Context Menu: Right-click any
.md or .markdown file in the Explorer view to preview or export.
- Mermaid Diagram Support: Render flowcharts, sequence diagrams, class diagrams, state diagrams, and ER diagrams without external dependencies.
- PlantUML Diagram Support: Render PlantUML diagrams with local Java and PlantUML JAR integration.
- Front Matter Configuration: Control document-level layout, margins, orientations, and custom fonts directly within Markdown.
- Custom Typography: Embedded Google Fonts and local font support with refined headings, bold weights, and technical table layouts.
Usage
1. Open Preview
Open a real-time side-by-side print preview matching target paper dimensions:
- Open a Markdown file in the editor.
- Click the md-tech-pdf: Open Preview icon in the editor title bar, or open the Command Palette (
Ctrl+Shift+P / Cmd+Shift+P) and run md-tech-pdf: Open Preview.
- The preview panel opens beside your editor, rendering typography and vector diagrams with high-speed in-memory caching.
2. Export to PDF
Export the currently active Markdown document directly to a PDF in the same directory:
- Open a Markdown file in the editor.
- Open the Command Palette (
Ctrl+Shift+P or Cmd+Shift+P).
- Run
md-tech-pdf: Export to PDF.
Output: document.md is compiled to document.pdf.
3. Export to PDF As
Export with a custom destination path and filename:
- Open a Markdown file in the editor.
- Open the Command Palette.
- Run
md-tech-pdf: Export to PDF As....
- Choose the target destination in the Save Dialog.
- In the VS Code File Explorer, right-click on any
.md or .markdown file.
- Select
md-tech-pdf: Open Preview or md-tech-pdf: Export to PDF.
Front Matter Configuration
You can customize PDF rendering options at the top of your Markdown file using YAML front matter.
Example:
---
title: System Architecture Design
pdf:
format: A4
landscape: false
margin:
top: 20mm
bottom: 20mm
left: 20mm
right: 20mm
fonts:
- name: "LINE Seed JP"
type: google
weights: [400, 700]
---
# 1. System Overview
This document demonstrates high-quality PDF export using `md-tech-pdf`.
Requirements
- Mermaid: Bundled within the extension. No extra runtime or installation is required.
- PlantUML: Requires a local Java runtime (Java 8+) and a PlantUML JAR file. Specify their paths in Settings if they are not in your default system PATH.
- Network: Required only when downloading external Google Fonts during export.
Configuration
Configure extension settings via VS Code Settings (Preferences: Open User Settings (JSON) or GUI):
md-tech-pdf.preview.refresh: Controls when an open preview is refreshed ("manual", "onSave", or "onType", default: "onSave").
md-tech-pdf.plantuml.javaPath: Path to the Java executable (default: "java").
md-tech-pdf.plantuml.jarPath: Path to the local plantuml.jar file (default: "").
md-tech-pdf.export.outputDirectory: Default output directory for exports. Leave empty to output next to the source Markdown file (default: "").
md-tech-pdf.export.afterExport: Action to perform automatically after export: "none", "open" (open in editor), or "reveal" (reveal in OS file manager) (default: "none").
Known Limitations
- Very large diagrams may push following content to a new page or leave white space if they exceed page dimensions.
- PlantUML requires Java and a valid
plantuml.jar installed on your machine.
- Google Fonts fetching requires an active internet connection during rendering.
License
Apache License 2.0. See LICENSE for details.
Repository
Source code and issue tracker: https://github.com/ikaruga-tech/md-tech-pdf