Session: add-pdf-invoice-export — 2026-11-03

ledger-api · ZCode · branch feat/pdf-export · glm-4.6 · 2026-11-03 16:20 · 1 msgs · 4 tools · 1 min read · updated yesterday

tools: Bash, Edit, Write
← ledger-api Download .md .txt .json
Tool calls
Write Write: 2 calls (50.0%) 2 Bash Bash: 1 call (25.0%) 1 Edit Edit: 1 call (25.0%) 1
Token usage112.0K total
Input12.0K
Cache creation24.0K
Cache read72.0K
Output4.0K
Cache hit ratio67%· warming up

Project: ledger-api · Branch: feat/pdf-export · Mode: default · Model: glm-4.6

Summary

Added PDF export for invoices with WeasyPrint and a Jinja2 template; PDFs are rendered in a background task and cached by invoice revision, so re-downloads are instant.

Conversation

Turn 1 — User

Export invoices as PDF. It should look like the HTML preview.

Turn 1 — Assistant

Reuse the HTML preview template, render with WeasyPrint in a background task, store under invoices/<id>/<revision>.pdf. The download endpoint streams the cached file.

Tools used in this turn:

  • Write: ledger/pdf.py
  • Write: templates/invoice.html
  • Edit: ledger/routes/invoices.py
  • Bash: pytest tests/test_pdf.py -q — 4 passed

Connections

  • [[ledger-api]]
  • [[WeasyPrint]]
  • [[Jinja2]]
  • [[BackgroundTasks]]

Keyboard shortcuts

⌘K / Ctrl+KOpen command palette
/Focus search
g hGo to home
g pGo to projects
g sGo to sessions
j / kNext / prev row (tables)
?Show this help
EscClose dialogs

Structured queries

Mix key:value filters with free text in the palette:

type:sessionOnly session pages
project:llm-wikiFilter by project name (substring)
model:claudeFilter by model name (substring)
date:>2026-03-01Sessions after a date
date:<2026-04-01Sessions before a date
tags:rustPages mentioning a tag/topic
sort:dateSort results by date (newest first)

Example: type:session project:llm-wiki date:>2026-04 sort:date