agentleFS
slogsdonslogsdon/skills-design/skills/pdf-paginated/SKILL.md

pdf-paginated

Skill3 starsChanged 3 months agoMITView on GitHub

Exports document-flow HTML to a PAGINATED PDF at a real paper size (Letter/A4), with a running folio footer (title · page X / Y). The long-form sibling to pdf-html: where pdf-html renders each .canvas to one tall auto-height page (right for social artifacts and audit reports), this paginates a whole document across pages — right for essays, field guides, specs, and anything meant to be read or printed as pages.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When the output should be Letter or A4 with real margins and page numbers, not a single tall canvas.

    line 27
  2. Distinctive:

    Default mode gives white paper margins.

    line 69
  3. Very specific:

    keep the reading column measured (max-width) and centered.

    line 82

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: pdf-paginated

Paginated document PDF via headless Chromium page.pdf({format, margin}). No .canvas targeting — the whole document flows across paper pages. A folio footer (title left, page X / Y right, JetBrains Mono) is rendered in the bottom margin.

When to use

  • Long-form documents where the reader expects pages: an essay, a field guide, a spec, a report body, a letter.
  • When the output should be Letter or A4 with real margins and page numbers, not a single tall canvas.

Skip if:

  • The artifact is a fixed-size design canvas (social post, business card, blog hero, audit-report canvas). Use pdf-html — it sizes the PDF to the canvas.
  • You want a PNG. Use screenshot-html.

The HTML it expects

Plain document-flow HTML, NOT the .canvas convention:

  • Content flows normally (body → article). No fixed-width .canvas wrapper.
  • Give the reading column a measure with max-width (e.g. 64ch) centered, and put the page surface color on body (it prints because printBackground is on).
  • Do not set @page size/margins in CSS — the script owns paper size and margins via --format / --margin. A CSS @page margin would double up.
  • Optional @media print rules to keep things tidy across page breaks: h2, li { break-inside: avoid; } and h2 { break-after: avoid; }.
  • Set a clean <title> — it becomes the footer's running head.
  • Self-contained styles (inline <style> or a resolvable @import); web fonts load fine (the script waits for document.fonts.ready).

How to run

node skills/pdf-paginated/scripts/pdf-paginated.mjs <dir> [--output <dir>] [--format Letter|A4] [--margin <css>] [--bleed <color>] [--no-footer]

Flags:

  • <dir> (positional, default .): directory scanned recursively for *.html. screenshots/, pdfs/, and hidden dirs are skipped.
  • --output <dir> (default <dir>/pdfs): where PDFs are written, one per HTML file.
  • --format (default Letter): Letter or A4.
  • --margin (default 0.9in): CSS length applied to all four sides. Ignored in bleed mode.
  • --bleed <color>: full-bleed page surface. See below.
  • --no-footer: drop the folio footer (in bleed mode the footer strip still paints).

Full-bleed backgrounds (--bleed <color>)

Default mode gives white paper margins. If the document has a committed background color (e.g. a cream editorial page), that background floats as a card on white — the margins show through. --bleed <color> fixes this: it zeroes the left/right margins so the HTML background reaches the side edges, and paints the top and bottom margin strips <color> so every page is that color edge-to-edge, with a per-page inset and no white bands. The folio still renders in the bottom strip.

In bleed mode the HTML owns only its side text insets (via body padding); the top/bottom insets are the painted strips. So the HTML should:

  • set the surface color on html and body with print-color-adjust: exact,
  • pad only the sides (e.g. padding: 0.1in 0.95in 0.3in), and
  • keep the reading column measured (max-width) and centered.
# cream editorial essay, full-bleed
node skills/pdf-paginated/scripts/pdf-paginated.mjs . --output ./pdfs --bleed '#fbfaf9'

Prerequisites

None — self-bootstraps on first run, installing Playwright + Chromium into its own node_modules next to the script (shared pattern with pdf-html / screenshot-html). First run ~10–60s; subsequent runs are fast.

Relationship to pdf-html

pdf-htmlpdf-paginated
Outputone auto-height page per .canvasdocument paginated across paper pages
Sizes tocanvas pixel dimensionsLetter / A4 + margins
Footernonefolio (title · page X / Y)
Use forsocial artifacts, audit-report canvasesessays, field guides, specs, reports

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.