Skip to content
Projetos

Sobre

PDF typesetting tool for Markdown files

Ferramentas de desenvolvimento

Como estes números são medidos

Crescimento medido de estrelas

em 24 h
+1
em 7 dias
+2
em 15 dias
+8
em 1 mês
Coletando histórico

Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.

README.md

Original

pfpdf

pfpdf is a command-line tool that converts Markdown documents into PDFs with support for Japanese typesetting. Use it to create technical reports and manuals with cover pages and tables of contents. It also supports tables, equations, and syntax highlighting.

日本語 · Website · Tutorial

A blue cover rendered with the pfn template Equations and a Mermaid diagram rendered with the pfn template A table and highlighted TypeScript code rendered with the notebook template

From left: a cover and a body page from the pfn template, followed by a table and code from notebook. The template gallery shows sample output from all seven bundled templates.

Create your first PDF

You need Node.js 22.12.0 or later and npm. The npx command below downloads and runs pfpdf.

Save the following as document.md. The settings between --- delimiters (front matter) specify the title, template, and document language.

---
title: Technical report
template: pfn
lang: en
---

# Overview

This PDF is generated with **pfpdf**.

Run this command in the directory containing document.md:

npx @pfnet-research/pfpdf@latest --input document.md --output document.pdf

The first run needs an internet connection to fetch the npm package and Chromium, the browser used for PDF rendering. The browser download can be several hundred megabytes; later runs reuse the cached browser. Rendering uses Vivliostyle CLI.

Open document.pdf to check the result: it contains a cover with the title, a table of contents, and the body text.

For CI or build steps you run repeatedly, pin the package version by replacing @latest with a version such as @0.2.1.

Combine chapters

To write chapters in separate files, put them in a directory such as chapters/ and pass that directory to --input:

npx @pfnet-research/pfpdf@latest --input chapters --output report.pdf

pfpdf combines .md files directly inside the directory in filename order; the extension must be lowercase. Use names such as 00_title.md, 01_intro.md, and 02_results.md to set the reading order. Put shared settings together in front matter at the top of the first file. See document structure for links between chapters, page breaks, and image paths.

Templates and Markdown

Set template in the front matter to choose a design. To try another design for one conversion, add an option such as --template notebook to the command; command-line arguments override front matter. Every bundled template also has a slide variant: add slides: true to build 16:9 slides in the same design (see slides).

The templates come with their default fonts, including Japanese fonts. For custom templates, logos, or local fonts, see templates and assets.

Environments and troubleshooting

CI tests PDF generation with a real browser in four environments:

  • macOS aarch64 (Apple Silicon)
  • Linux x86_64
  • Windows x86_64
  • Linux aarch64

Linux also needs system libraries for Chromium. If conversion fails, run the environment check:

npx @pfnet-research/pfpdf@latest --doctor

The check reports problems with Node.js, the browser, and fonts, along with suggested fixes. See troubleshooting for Linux setup and other conversion errors.

Input documents

Use pfpdf only with trusted documents. It renders input HTML and executes scripts as-is, with access to local files readable by pfpdf and to external URLs.

Remote images and other external resources must be available during conversion. The security policy describes the trust model and how to report vulnerabilities.

Documentation and development

Document Japanese English
Tutorial: usage and document examples Japanese English
Design: specification and design decisions Japanese English

The Japanese documents are the source for the specification and usage; the English documents are translations. Each GitHub Release includes all four PDFs. To build PDFs of the design and tutorial documentation locally or contribute to development, follow the setup instructions in Contributing. Run make docs to build the documentation PDFs.

See the CLI reference for all options.

License

pfpdf's code is released under the MIT License. Dependencies and bundled assets have their own licenses, including AGPL-3.0 for Vivliostyle CLI. See third-party licenses for the list.

Explore projetos relacionados

Carregando…