TreePress
Your code, exactly as you see it — in PDF.
TreePress exports any file open in VS Code to a pixel-faithful, searchable
PDF. It captures your editor's exact syntax colours and theme, so the PDF
looks identical to what you see on screen. No configuration required — open
a file, run the command, and download.
Features
- Pixel-faithful rendering — uses headless Chromium to capture colours,
fonts, and layout exactly as VS Code renders them
- WYSIWYG capture — exports HTML and Markdown at the page's actual
rendered width and height, so the PDF matches what you see in a browser
- Tab-aware HTML export — when an HTML page uses a tab UI (Bootstrap,
ARIA, Material, Flowbite, Preline, jQuery UI, DaisyUI, custom, and others),
TreePress captures every tab into its own page, draws a clickable tab
index on page 1, and adds one PDF bookmark per tab so the bookmarks panel
in any reader becomes a tab-by-tab navigator
- Chart library support — Chart.js, ApexCharts, ECharts, Highcharts,
Plotly, and Google Charts all render correctly in the PDF, including
charts inside inactive tab panels that would normally render blank
- Single-page mode — for rendered HTML and Markdown, optionally export
the whole document as one continuous page with no page breaks
- Searchable PDF — an invisible text layer makes every exported PDF
copyable and searchable
- Table of Contents — PDF bookmarks generated automatically from code
symbols, Markdown headings, or detected tabs
- Theme support — exports using your active VS Code theme, or pick any
installed theme from the options panel
- Markdown rendered export — render Markdown as a formatted document
(headings, tables, code blocks) or export the raw source
- Jupyter Notebook support — exports code cells and output cells
including images
- Git footer stamp — optionally prints branch, commit hash, author, and
date on every page
- Preview before download — review the PDF in an in-editor panel, tweak
options, and re-render before saving
- CDN script allow-list — chart and stylesheet libraries loaded from
CDNs are permitted during rendering; data-exfiltration vectors (XHR,
fetch, image, font, websocket) remain blocked
Requirements
VS Code 1.90 or later.
How to Use
Three ways to trigger an export:
- Right-click the active editor → TreePress: Export to PDF
- Command Palette (
Ctrl+Shift+P / Cmd+Shift+P) →
type TreePress: Export to PDF
- Keyboard shortcut
Ctrl+Shift+Alt+E (same on macOS)
For access to export options before rendering, use
TreePress: Export to PDF with Options — available via the same methods.
The export flow:
- TreePress renders the file and opens a PDF preview panel.
- Use the page number input or the
» button in the preview toolbar to
navigate pages before downloading.
- Optionally open the options sidebar to adjust settings and click
Adjust to re-render.
- Click Download to save, or Cancel to dismiss.
Export Options
| Option |
Description |
| Theme |
Use the active VS Code theme or select any installed theme |
| Force white background |
Override dark backgrounds for cleaner printing and sharing (disabled for light themes and visual exports such as HTML and images) |
| Font size |
Match your editor font size or choose 10 / 11 / 12 px |
| Line numbers |
Show or hide line numbers in the exported PDF |
| Page size |
Letter, A4, or Legal |
| Margins |
Normal (0.5 in), Narrow (0.25 in), or Wide (0.75 in) |
| Page layout |
(Rendered HTML and Markdown only) Paginated standard pages or one continuous Single page |
| Git footer stamp |
Print branch, commit, author, and date on every page |
Supported File Types
| File Type |
Extensions |
Export Mode |
| Source code |
Most languages (.ts, .py, .rs, .go, …) |
Syntax-highlighted source |
| Web files |
.css, .scss, .sass, .less, .jsx, .tsx, .vue, .svelte |
Syntax-highlighted source |
| HTML |
.html, .htm |
Rendered webpage with tab detection, chart library support, and clickable PDF bookmarks per tab; or syntax-highlighted source. Page options apply; theme and typography options do not. |
| JSON / YAML / TOML / XML |
.json, .yaml, .toml, .xml |
Syntax-highlighted source |
| CSV / TSV |
.csv, .tsv |
Styled table |
| Markdown |
.md, .markdown, .mdx |
Rendered document or syntax-highlighted source |
| Jupyter Notebooks |
.ipynb |
Rendered cells with outputs |
| Config / plain text |
.env, .txt, .ini, .conf, .log, … |
Syntax-highlighted source |
| Images |
.png, .jpg, .jpeg, .gif, .svg, .webp, .bmp |
Centred on page (page options only) |
Tab-aware HTML export
When you export an HTML file that contains a tab UI, TreePress detects the
tab pattern automatically and produces a multi-page PDF with one tab per
page. No configuration required — it just works for the patterns below.
Recognised tab patterns:
- ARIA:
[role="tab"] with aria-controls (Radix, shadcn, MUI,
Headless UI, Mantine, Ant Design)
- Bootstrap 5:
data-bs-toggle="tab"
- Bootstrap 4:
data-toggle="tab"
- Flowbite:
data-tabs-target
- Preline UI:
data-hs-tab
- TW Elements:
data-te-toggle="tab"
- Material Angular:
.mat-tab-label, .mdc-tab
- jQuery UI:
.ui-tabs-nav .ui-tabs-tab
- onclick-based custom JS tabs:
showTab(), switchTab(), openTab(),
selectTab(), changeTab(), activateTab()
- Generic
[data-tab] attributes
- DaisyUI / CSS-only radio tabs:
<input type="radio"> groups
:target CSS tabs: <a href="#anchor"> link groups
Each tab becomes one PDF page. Page 1 carries a tab index strip with all
tab labels — the active tab is highlighted; inactive labels are clickable
GoTo links that jump to that tab's page. The PDF bookmarks panel opens
automatically with one entry per tab, so any reader (Chrome, Acrobat,
Preview, Firefox, Edge) gets a tab-by-tab navigator.
Charts inside hidden tab panels — the historically blank case — render
correctly. TreePress activates each tab in turn, lets the chart library
re-measure its container, and freezes the canvas before capture so print-
media swaps cannot blank it.
Troubleshooting
TreePress writes diagnostic output to a dedicated channel. Open
View → Output (Ctrl/Cmd+Shift+U) and select TreePress from the
dropdown. Trigger an export to see live entries, tagged by subsystem:
[Network] ALLOW|BLOCK <type> <url> — which CDN resources loaded
during rendering
[TSAN] … — tab detection, per-tab capture sizes, and assembly
[PreviewPanel] … — host-side preview delivery (small or chunked)
[Webview] … — webview-side message arrivals and pdf.js status
If charts come out blank, check for a missing chart-library URL in the
Network log. If the preview panel stays blank, check the Webview log for
a getDocument rejected line.
Known Limitations
- Image viewer — right-click export is not available when an image is
open in VS Code's built-in image preview. Use the Command Palette or
keyboard shortcut instead.
- Notebook output cells — right-click export from a notebook output cell
is not available due to VS Code platform constraints. Trigger the export
from the Command Palette or keyboard shortcut while the notebook editor
is focused.
- Large files — files exceeding 15,000 lines cannot be exported in full.
Break the file into smaller parts, or open a specific function or section
in a new editor window and export that instead.
License
MIT
| |