build_render_character_sheet
Generate a standalone HTML character sheet for Pathfinder 2e with all rules text, spells, features, and equipment, returning a summary.
Instructions
Write a print-ready, fully self-contained HTML character sheet and return a summary of what went onto it.
The rendered file has no external dependencies of any kind -- fonts are
inlined as base64 WOFF2, all ornament is generated inline SVG, and there
is no stylesheet, script, or image fetched at view time -- so it can be
sent to a player as a single attachment and printed unchanged. Open it and
use the browser's own Print dialog (enable background graphics).
The HTML is written to `output_path` and deliberately not returned: a
real sheet runs to 150 KB or more, which would swamp a tool response.
Sections rendered, each only when the character data supports it:
core statistics (attributes, skills, AC and shield, saves, HP,
Perception, strikes, spell DC, conditions tracker); one spellcasting
page per entry in `spellCasters`, with every spell's complete rules text
and traits; features, led by a deity block where there is one (see below)
and then ancestry, heritage, background, level-appropriate auto-granted
class features, any detected subclass, and every feat; equipment with item
rules text; a notes page showing how each number was derived; and a licence
attribution page listing only the sourcebooks actually quoted.
The deity block distinguishes three cases, reported as `deity.status`:
* `none` -- the character follows no deity, including when the export
writes its own placeholder ("Not set", an empty string, a dash). No
block is rendered.
* `resolved` -- the recorded name matched the rules data. Renders every
mechanical field the game defines (divine font, sanctification, skill,
favored weapon, primary and alternate domains, divine attribute, and the
deity's cleric spells resolved to names by rank) followed by its full
descriptive text: title, areas of concern, edicts, anathema, iconography.
Pantheons, covenants and philosophies resolve here too, labelled as such.
* `unrecognized` -- a name is recorded but isn't in the database, i.e. a
home-game or non-standard pantheon. Renders a labelled block with ruled
lines for the standard fields to be filled in by hand. This is *not*
treated as a defect in the character data and is deliberately kept out
of `unresolved`.
Everything is derived from `character` plus this project's ingested rules
data -- there is no authored commentary, so a sheet is exactly as complete
as the character export it came from. Two things follow from that worth
knowing before you call it:
* A character with no `spellCasters` block gets no spell pages, even if
the class is a caster. Pathbuilder exports populate it; hand-written
character JSON often doesn't.
* Class features come from the ingested `class_progression.granted_items`
filtered to the character's level, because exports record only choices.
A subclass (cleric doctrine, druid order) is recovered by matching the
class's tagged option names against the character's free-text
`specials`, which is best-effort -- check `subclass` in the result.
`paper` accepts 'letter' (default) or 'a4'; it sets the @page size, and
content reflows rather than being scaled.
`logo_path` embeds an image top-left on page 1 in place of the sheet's own
spiral mark -- intended for the Pathfinder logo from Paizo's Community Use
Package, which the Community Use FAQ permits on free fan material. Accepts
PNG, SVG, JPEG, GIF or WebP (not EPS or AI, which browsers can't display).
The bytes are embedded verbatim and scaled by height with automatic width,
so the logo is never recoloured, cropped or distorted -- the policy forbids
altering a logo's colour, typography, design or proportions, and permits
proportional resizing. Section headings keep the spiral, so the sheet still
has a mark of its own. Omit to use the spiral everywhere.
`symbol_dir` points at a directory of deity symbol images named after the
deity ("Pharasma.png"), such as Paizo's Community Use "Pathfinder Religious
Symbols" pack -- underscores in place of spaces are matched too, so
"Sun_Wukong.png" resolves. When the character's deity resolves and a
matching file exists, the symbol is embedded beside the deity block's stat
table, again scaled by height only. A missing symbol is not an error: the
block simply renders without one.
Returns a dict with the output `path` and `bytes`, the `sections` written,
counts of what was rendered, the detected `subclass`, the sourcebooks
quoted under each licence, and -- importantly -- `unresolved` names and
`warnings`. An item the export calls "Repair Kit" where the rules data has
"Repair Toolkit" is reported there rather than guessed at or dropped
silently, so treat a non-empty `unresolved` as something to fix in the
character data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| paper | No | letter | |
| character | Yes | ||
| logo_path | No | ||
| symbol_dir | No | ||
| output_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||