Skip to content

PDF generation

John R. D'Orazio edited this page Feb 27, 2026 · 1 revision

PDF Generation

How to produce a print-ready PDF of the bylaws from BYLAWS.md.


Prerequisites

  • Node.js with npm install completed in the repo root
  • Pandoc installed as a system dependency (installation docs):
    • Debian/Ubuntu: sudo apt install pandoc
    • macOS: brew install pandoc

Steps

PDF generation is a two-step pipeline:

1. Build standalone HTML

npm run build:html:standalone

This runs Pandoc to convert BYLAWS.md into a self-contained HTML file at dist/bylaws-standalone.html, embedding the print stylesheet (scripts/bylaws-print.css) and the TeX Gyre Schola font files directly into the document.

2. Generate PDF

npm run build:pdf

This runs pagedjs-cli (installed via npm) on the standalone HTML to produce dist/bylaws.pdf. The PDF uses US Letter page size with running headers (foundation name on the left, current article title on the right) and page numbers in the footer.

Note: build:pdf requires the standalone HTML to exist first. Always run build:html:standalone before build:pdf.


Output files

File Description
dist/bylaws-standalone.html Self-contained HTML with embedded CSS
dist/bylaws.pdf Print-ready PDF (US Letter)

CI / Automated builds

When a version tag is pushed and CI governance checks pass, the Deploy Bylaws to WordPress workflow automatically:

  1. Builds the standalone HTML and PDF
  2. Creates a GitHub Release attaching both dist/bylaws-standalone.html and dist/bylaws.pdf

No manual PDF generation is needed for official releases.


Print stylesheet

The PDF styling is defined in scripts/bylaws-print.css. Key features:

  • Font: TeX Gyre Schola (a Century Schoolbook derivative, bundled in fonts/tex-gyre-schola/)
  • Page size: US Letter with 1" top/bottom and 1.25" left/right margins
  • Running headers: Foundation name (top-left), current article title (top-right), suppressed on the first page
  • Footer: "Page X of Y" centered
  • Flow control: Headings avoid breaking after, list items avoid breaking inside, orphans/widows set to 3

Clone this wiki locally