Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

PDF Export

Mimir generates PDFs from campaign data using Typst, a modern typesetting system compiled in-process by the mimir-print crate. Every export returns the finished PDF to the frontend as base64 data, where it can be previewed and saved to disk.

Export Types

ExportContentsTriggered from
CharacterFull character sheet, plus optional compact sheet, battle card, spell cards, and equipment cardsCharacter print dialog (how-to)
Single documentOne campaign document rendered from its markdown contentDocument editor (how-to)
CampaignCampaign documents, module content, NPCs, map previews, true-scale tiled maps, and token cutouts, toggled per sectionCampaign export dialog
ModuleModule documents, monster cards, trap cards, points of interest, NPCs, play notes, and map preview/play pages, toggled per sectionModule export dialog (how-to)
MapPreview page (fit to one page) and/or true-scale tiled play pages with token cutoutsMap print dialog (how-to)
Monster cardsHalf-page reference cards for one monster, or all monsters in a moduleexport_monster_card / export_module_monsters commands
Trap cardsHalf-page reference cards for one or more trapsexport_trap_card / export_trap_cards commands

Tauri Commands

The application registers twelve print commands (crates/mimir/src/main.rs), implemented in crates/mimir/src/commands/print/.

CommandParametersDescription
list_print_templatesList .typ files found under the app data templates/ directory
export_charactercharacter_id, options?Character sheet with optional compact sheet, battle card, spell cards, equipment cards
export_campaign_documentdocument_idRender a single campaign document
export_campaign_documentscampaign_id, options?Combined campaign PDF with per-section toggles
export_module_documentsmodule_id, options?Combined module PDF with per-section toggles
print_mapmap_id, options?Map preview and/or tiled play pages
generate_character_sheetcharacter_id, template?Legacy API; currently returns a “not yet implemented” error
save_pdfpdf_base64, pathDecode base64 PDF data and write it to a file
export_module_monstersmodule_id, options?Cards for every monster in a module
export_monster_cardmonster_name, monster_source, options?Card for a single catalog monster
export_trap_cardtrap_name, trap_source, options?Card for a single trap
export_trap_cardstraps (list of name/source pairs), options?Cards for multiple traps

Card commands accept a show_cut_lines option. Map and module options include grid overlay, line-of-sight walls, starting positions, and token cutout toggles.

All rendering commands return ApiResponse<PrintResult>, where PrintResult contains pdf_base64 (the PDF as base64) and size_bytes (the decoded size). save_pdf returns ApiResponse<()> and list_print_templates returns a list of { id, name, category } entries.

Section Types

PDFs are assembled from typed sections (crates/mimir-print/src/sections/), each of which produces Typst markup:

SectionDescription
Markdown documentCampaign/module documents with optional YAML frontmatter (title, type) converted from markdown to Typst
Character sheetBasic info, ability scores, classes, and roleplay elements
Character battle cardHalf-page (3.875“ × 5.125“) combat reference cards in a 2×2 layout, for PCs and NPCs
Monster cardsHalf-page (3.875“ × 5.125“) stat-block cards in a 2×2 layout
Spell cardsMulti-up cards; long descriptions split at natural boundaries onto foldable continuation cards
Equipment cards2.5“ × 3.25“ cards for weapons, special ammo, and magic items
Map previewMap fit to a single page, with options for grid overlay, line-of-sight walls drawn as red lines, and starting positions as numbered circles
Tiled mapMap rendered at true scale across multiple labeled pages for physical play
Token cutoutsFold-in-half paper standees sized by creature category (tiny through gargantuan), with per-token quantity
Trap cardsHalf-page (3.875“ × 5.125“) cards showing trigger, effect, countermeasures, and details

Rendering Pipeline

Each command gathers data from the database, builds the relevant sections, and assembles them with a DocumentBuilder. The combined Typst source is compiled in-memory by the Typst compiler library inside a custom MimirTypstWorld — no external Typst CLI and no temporary data files are involved. Images (maps, tokens) are passed to the compiler as in-memory virtual files.

Shared Typst components are embedded in the application binary (crates/mimir-print/src/embedded_templates.rs): _shared/styles.typ, _shared/components.typ, and _shared/icons.typ. Imports of these paths are resolved from the embedded copies before any disk lookup. The embedded styles define grayscale, print-friendly colors and the font stacks Inter / Helvetica / Arial (headings and body) and JetBrains Mono / Consolas (monospace).

Fonts are not bundled: the compiler uses system fonts, discovered once per process via fontdb (crates/mimir-print/src/world.rs). If the first font in a stack is not installed, Typst falls back through the stack.

Template Directory

list_print_templates scans the templates/ directory inside the application data directory, recursively collecting .typ files (anything under a _shared/ directory is skipped). Each entry’s id is its relative path without the extension, its category is the first directory component, and its name is the title-cased file name. If the directory does not exist, the command returns an empty list.

This listing is informational only: the export commands above generate their Typst source from the embedded section types and embedded shared components, and do not render user-supplied .typ files.