# Li Generate PDF

> Use to produce a PDF from selected source content through an available converter or accepted browser print operation; Lintel does not read the produced PDF, so its text, pages and visual rendering stay unverified.

- Skill: `jokerman89/li-generate-pdf` (Agent Skill)
- Install (CLI): `npx get-skill add jokerman89/li-generate-pdf`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jokerman89/li-generate-pdf/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: jokerman89 (https://skillmd.com/u/jokerman89)
- Updated: 2026-11-15
- Page: https://skillmd.com/skills/jokerman89/li-generate-pdf

---


> **Lintel on GitHub Copilot.** Generated from `skills/generate-pdf/SKILL.md`; edit the canonical file, then run
> `li-copilot init`.
> - **Resource root:** `../../..` from this skill's base directory (the Lintel source with `bin/`,
>   `lib/`, `skills/`). Write plans, state and evidence into the working repository's `.claude/`
>   tree, never into the resource root.
> - **Skill-relative paths:** this skill's own `scripts/`, `references/` and `data/` folders (and a
>   `<base>` that the workflow defines as its own directory) mean
>   `../../../skills/generate-pdf/` in the Lintel source, not this generated folder.
>   `${LINTEL_SKILLS_DIR:-skills}` means the skills root, `../../../skills`. A `bin/li-run` step
>   runs in the working repository, so use `$LINTEL_SKILLS_DIR/generate-pdf/` there.
> - **Shell steps:** run Bash snippets with Bash (Git for Windows' `bash.exe` on Windows, never
>   `System32\bash.exe`). Save a snippet to a temporary `.sh` file and run
>   `bash "<resource root>/bin/li-run" <file>`; it prepares `LINTEL_SOURCE_ROOT`, `LINTEL_REPO_ROOT`
>   and the profile context.
> - **Tools:** Read=`view`, Write=`create`, Edit=`edit`, Bash=`bash`/`powershell`, Grep=`grep`,
>   Glob=`glob`, AskUserQuestion=`ask_user`, TodoWrite=the plan checklist, Task or a named role=`task`
>   with that custom agent, WebFetch=`web_fetch`.
> - **Other Lintel workflows** are native skills: invoke `/li-<name>` rather than reading their
>   files. Named roles such as `CodeReviewer` are custom agents.

# /generate-pdf

Produce a PDF from an explicit source while preserving its full
argument, tables, citations, code, units and material limitations. Standalone
production does not require an unaccepted shared design schema. Retain editable
source even though PDF editing is not promised.

## Inputs and compatibility

- `--brief <path|inline>` or `--input <path|url>` selects the complete source.
  Retain inline input as an owned file. HTML and Markdown paths use the procedure
  below; URL input uses an actually authorized guarded browser route.
- `--from-pipeline <run-dir>` uses the
  [existing input admission](../../../skills/generate-write/references/fidelity-and-evidence.md#existing-pipeline-input-admission)
  with `--format pdf`, external input context, original package/leaves and live
  profile. Retain the full content and design bytes without inventing a
  `per_format.pdf` layout. Input admission is not a conversion or PDF inspection.
- `--out <path>` selects the PDF destination. If omitted, propose
  `<input-stem>.pdf` in the working directory and apply the same explicit
  ownership/no-overwrite checks before publication. Inline input first gets an
  owned editable source; URL input uses its selected document name, never a
  credential-bearing query string.
- `--format <a4|letter|custom>` defaults to `a4`; `--orientation
  <portrait|landscape>` defaults to `portrait`. Custom size requires explicit
  `@page` print CSS, not a guessed dimension.
- `--header-footer <yaml>` selects declarative title/date/page content;
  `--print-css <path>` selects the print stylesheet. Missing or malformed
  explicit input stops before print rather than silently choosing a default.
- `--no-background` removes CSS backgrounds for print, not content images.
- `--customer-share` applies the actual profile's customer-facing controls.
  `--accessible` requires actual PDF structure/reading-order/link/accessibility
  evidence, not merely searchable text or a structure-tree flag.

## Select a real writer

Inspect actual converter and browser APIs before calling them.
Use available declared Pandoc or Markdown-it, including the explicitly selected
`markdown-it-py` API. The format-local helper imports Markdown-it only for Markdown
input; it does not implement a replacement parser. Missing conversion blocks that
input mode, rather than flattening tables or treating plain text as conversion.

In the released environment, Node/Python Markdown-it imports and the allowlisted
Pandoc lookup failed. One manifest-declared task-local converter download failed
TLS negotiation; no installation or verification bypass followed. The independent
**explicit HTML** route remains usable. AI-authored HTML from a brief is retained
and compared with the complete source; it is not an executed Markdown conversion.

Use the accepted [browser provider](../../../skills/web-session/references/browser-operations.md)
for real print, with P03 URL guards and caller-verified P07 work/profile context.
The helper consumes public `Admission`, `BrowserSession.start`, `open`, `media`,
`read`, `print` and `close` operations, not a daemon or private CDP extension.
It never attaches to a personal browser/profile.

Lintel has no PDF reader. It does not parse, render or inspect the produced PDF,
and it does not depend on a PDF library (ADR-0033). An existing reader or viewer
is an explicit, separately authorized choice needing its own observations.
Word/PPT export remains a possible independently authorized source strategy, not
an automatic fallback. Denied Word/Excel/UI/PDF-raster operations cannot be retried
through COM, another launcher, provider or export tool.

## Local production procedure

1. Read the whole brief and source ledger. Preserve evidence, qualifications,
   tables/units, code and material limitations. Retain the editable source and
   explain transformations; do not shorten it to meet a page-count target.
   In pipeline mode, use the admitted full content through the same explicit
   HTML or available converter route. Keep source-to-HTML/print-CSS provenance,
   select CSS/config overrides, and retain a missing converter as a real gap.
2. Resolve explicit owned input/output/CSS/header-footer paths. Verify current
   P07 reference/policy and selected work identity. Declare P05 fidelity, print
   and complete visual requirements before observing them. Neutral
   defaults do not invent brand, disclosure or score gates.
3. Prepare print HTML with `scripts/prepare_html.py`, an explicitly selected
   available converter, or a supplied complete HTML document. The helper preserves
   supplied HTML and inserts print CSS into its actual head; Markdown mode needs
   the declared library. It writes a new owned HTML path using P03 expected-state
   checks. Literal `</head>` text inside title/textarea is not a head boundary;
   real duplicate closing heads still refuse. Source, CSS and prepared HTML
   remain separate artifacts.
4. Start an invocation-owned loopback server serving only the selected document
   and explicitly authorized local assets. Bind 127.0.0.1, observe a real health
   response, and retain the actual origin/server handle. The accepted provider
   checks that exact scheme/host/port and every request/redirect. This is not
   OS-wide network isolation.
5. Invoke `scripts/print_pdf.mjs` with the actual preview URL/origin, absolute
   browser/Python executables, owned output root and unchanged verified
   session/work-map/profile context. It creates a fresh context, enables print/
   reduced-motion media, reads the page, calls actual print and closes the
   context/process/profile in `finally`. Stop the exact server and verify cleanup,
   including failures. Missing APIs or provider errors do not become success.
6. Do not read or inspect the produced PDF with Lintel: it has no PDF reader.
   Searchable complete content, page-specific material, physical paper dimensions
   and text positions stay unverified unless a separately authorized reader or
   viewer observes them. File size and exit codes are not QA.
7. Obtain complete rendered-page inspection through an actually permitted route:
   clipping, glyphs, table continuation, heading orphans, code, references, images
   and headers/footers. Text/origins or HTML print-media screenshots are not
   images of every PDF page. Missing/denied rendering remains unverified.
8. Bind exact source/config/tool/output observations with existing P05/P07. Retain
   the owned PDF with its partial evidence when a required inspection is unavailable.
   Writing it does not authorize distribution, independent clearance or SHIP.

## Helper interfaces and limits

Use the host's native path spelling and line-continuation syntax:

```text
python <trusted-source>\skills\generate-pdf\scripts\prepare_html.py --root <owned-root> --input brief.html --out prepared.html --format a4 --orientation portrait --header-footer header-footer.yaml --print-css print.css
node <trusted-source>\skills\generate-pdf\scripts\print_pdf.mjs <owned-print-request.json>
```

Preparation accepts `.md`/`.markdown` only with its available converter.
Header/footer YAML uses the existing data-only P07 parser and only `header`/
`footer` strings with `{{title}}`, `{{date}}`, `{{page}}`, `{{total}}`.
These become CSS page-margin content, not an invented native header/footer API.
Custom paper needs explicit `@page` CSS and observed PDF dimensions.
`--no-background` clears CSS backgrounds, not content images; it does not
pretend to change the accepted provider's fixed print options.

The print request has exactly `url`, `origin`, `python`, `executable`, `outputRoot`,
`name` (new simple `.pdf` filename) and `context` (unchanged verified
`session_id`, `work_map`, `profile_ref`, and source identity when supplied).
The caller resolves policy and permission. The PDF initially lives in the owned
browser run; publish to `--out` only with explicit ownership/expected-state
checks, preserving unverified QA status when applicable. No overwrite, URL
refusal, incomplete cleanup or timeout is converted to successful completion.
The provider's real DOM read bounds cause explicit refusal, never source truncation.

## Direct conversion examples

```text
/li-generate-pdf --input design-doc.md --out design-doc.pdf
/li-generate-pdf --input report.html --format letter --orientation landscape --out report.pdf
/li-generate-pdf --input https://docs.example.com/runbook --header-footer header-footer.yaml --out runbook.pdf
```

Markdown requires its selected available converter. URL input requires an authorized
guarded origin with no personal cookies or credential transfer. These are invocation
examples, not executed conversion or inspection evidence. Use
`/li-web-session --mode browse` for page interaction without PDF output and
`/li-generate-web --mode mockup` for an editable single-file HTML source.

## Reusable patterns

Follow the [reusable pattern consumer contract](../../../skills/pattern/references/consumer-contract.md).
This remains the working PDF writer described above; patterns do not change its status or
procedure. Resolve, or verify a supplied attachment, before preparing the HTML source.
Conversion must preserve every section and clause required by the source document. Check each
required section in the readable source and in the prepared HTML before printing: a section
absent there is **failed** at the source, not unknown. No PDF reader is added: report required
content not inspected in the produced PDF as unverified.

## Roles, status and evidence

Retain WordTechnicalEditor as the read-only document-structure/accuracy method,
with the accepted accessibility/security methods when required by content/policy.
Use actual available delegation only; do not invent a role or independent review.
Apply configured brand references from explicit verified paths, never a personal
template scan. A PDF visual reference is not itself a writer or required template.

- **DONE:** every applicable mandatory control in the selected required QA inventory
  was actually met, including required PDF text, page, visual, fidelity and policy
  observations. Successful preparation/print cannot stand in for inspection.
- **DONE_WITH_CONCERNS:** all selected mandatory observations are complete; only
  advisory concerns remain.
- **BLOCKED:** missing selected converter, writer or print error, partial content,
  failed required check, unknown required applicability, or any missing/unverified
  mandatory PDF text, page or visual observation.
- **NEEDS_CONTEXT:** missing source/output authority or unresolved applicability.

**Partial artifact, not completion:** when writing succeeds but a required observation
is unavailable, preserve and return the owned PDF path with **BLOCKED** and the exact
missing obligations. Do not call that an inspected/complete PDF. The QA inventory is
selected before observations; never omit, downgrade or waive a requirement after seeing
the result, and never restore/install the removed reader to bypass its boundary.

Record exact input/output hashes, converter/library/browser versions, actual
URL/origin/process/context/cleanup evidence and the precise text, page and visual
gaps. QA observations are not structured independent decisions/corroboration;
an explicit denial of those writes stays binding. Shared pipeline, accessible
PDF certification and other formats retain their own actual acceptance.

