Lpdf for VS Code
Lpdf for VS Code is a PDF viewer, a PDF preview and export for Markdown files, a visual diff for PDFs, and an editor for Lpdf documents in XML with a live preview, all running on your machine.
Preview PDF
Right-click a .pdf file in the Explorer and select Lpdf: View PDF, or use the command palette. To open every PDF this way, turn on the lpdf.defaultPdfViewer setting. It follows your light or dark theme.

- Page thumbnails.
- Text search, with highlight all, match case, diacritics and whole words.
- Zoom by field, buttons, pinch or Ctrl and the mouse wheel, from 10% to 1000%, with a toggle between fit to width and fit to page.
- A two-page view, with or without a cover page.
- Save, and document properties.
Markdown to PDF
Preview next to the file
Right-click a .md file in the Explorer and choose Lpdf: Preview PDF, or use the button in the editor's title bar, to see it as a PDF beside it. The same commands are lenses above the first line of the file.

- Preview PDF, in the lenses above the first line with Export PDF and the links below. The button in the editor's title bar does the same.
- The PDF, set on A4 pages. It updates each time you save the
.md file.
- The editor and the preview scroll together, whichever you move.
Export to PDF
Right-click a .md file in the Explorer and choose Lpdf: Export PDF to save the PDF, or use Export PDF in the lenses above the first line.
Style the PDF
Lpdf: Link Markdown Styles... writes a look beside the .md file for you to edit, and Lpdf: Create Lpdf Document a page of your own around the Markdown: its size, margin, cover, header and footer.

- Link Styles... in the lenses above the first line, or Lpdf: Link Markdown Styles..., opens the menu.
- The looks to start from: Sans, Serif and Typewriter.
- The file the look is written to, next to the
.md file, for you to edit.
How styles and documents link to a .md file, its front matter and its images: Markdown to PDF in the docs.
Diff PDF
Right-click a modified PDF in the Explorer and select Lpdf: Compare PDF with HEAD, or choose it from the ... menu of an open PDF's tab, to see the version in your last commit beside your working copy. Lpdf: Compare PDF with branch... compares with a branch or a tag instead. When you click a changed PDF in the Source Control view, Lpdf offers to open it this way.

- HEAD: the PDF as of your last commit, with its page count and size. With Compare PDF with branch..., the branch or tag you picked.
- Working copy: the file on disk.
- What changed: here, the colour of the heading.
- Sync scroll: both sides scroll together. Untick it to scroll them apart.
- One zoom for both sides: the buttons, a typed percentage, the fit button, or a pinch.
- The info button: a table of both documents' properties.
|
The info button opens the two documents' properties, such as size, page count and producer, in two columns.
- A property that differs is marked.
- How many of them differ.
|
|
Author PDFs
Lpdf describes a document in XML, or in code, and renders the same PDF on every platform. This extension is where you write the XML.
Start from a template
Run Lpdf: New Document..., or choose it under File > New File... or on a folder in the Explorer, and pick one of seven templates, from a one-page letter to a 117-page book. A template's data, fonts and images are written beside it.
Live preview
Any .xml file whose root element is <lpdf> is an Lpdf document. Run Lpdf: Preview PDF, or use the buttons above <lpdf>, to open the rendered PDF beside your XML. It updates each time you save.

- Buttons above the root element: preview, export, generate code, and link a data file. The Lpdf ◆ item in the status bar opens the preview too.
- The preview, which updates when you save.
- The viewer's toolbar, with search, zoom, page views, save and properties.

Autocomplete, validation and hover docs
The XML is checked against the Lpdf schema as you type.
|
Completion offers only what the schema allows at that point.
- Mistakes are underlined as you type: here, the unfinished tag.
- The elements that can go inside this one.
|
|
Hover an element or an attribute for what it does, the attributes it takes, and the values each accepts. The text comes from the Lpdf schema.
- What the element is for, and where the documentation comes from.
|
|
Generate code
Run Lpdf: Generate Code to turn the saved XML into SDK code that builds the same document. It opens beside your template.

- Choose the language: JavaScript, Python, Java, C# or PHP.
- Your template.
- The code that builds the same document.
Data, images and export
A <name>.data.json file next to <name>.xml is the document's data, or Lpdf: Link Data File... links another. Images and fonts load from disk. Lpdf: Export PDF saves the PDF, and asks for passwords when the document asks for encryption. How each works: Author Lpdf documents in the docs.
Works offline
The Lpdf engine, PDF viewer, and export all run locally on your machine. No server round-trips, no accounts: your documents stay on your machine. The extension collects no telemetry. The Red Hat XML extension it depends on asks for your consent to its own.
Requirements
- Red Hat XML, for the schema's completion and validation. It is installed with the extension, also if you only use the PDF viewer.
Docs
lpdf.io/docs/vscode
Issues
Report bugs and request features at github.com/lpdfio/lpdf/issues, the one tracker for the engine, the SDKs and the VS Code extension. Pull requests are not accepted.
Licensed under the Lpdf for VS Code License. See LICENSE for full terms.