Skip to content

feat: replace react-pdf with Typst backend for PDF generation#212

Open
madisvain wants to merge 1 commit into
mainfrom
feat/typst-pdf-generation
Open

feat: replace react-pdf with Typst backend for PDF generation#212
madisvain wants to merge 1 commit into
mainfrom
feat/typst-pdf-generation

Conversation

@madisvain
Copy link
Copy Markdown
Member

Summary

  • Replace @react-pdf/renderer with Typst templates compiled on the Rust backend via typst-as-lib, removing 50 npm packages
  • Add src-tauri/src/pdf.rs module that embeds the Typst template and Montserrat fonts, accepts pre-formatted JSON from the frontend, and returns PDF bytes
  • Add src-tauri/templates/invoice.typ and `quotation.typ** Typst templates with A4 layout, header/footer, line item table, tax groups, and optional logo support
  • Update frontend (details.tsx) to call invoke("generate_pdf") for both preview and download, sending all currency/date formatting and i18n labels as pre-formatted strings

Test plan

  • Open an existing invoice with a client selected → click "View" → PDF preview renders
  • Click "PDF" → file downloads correctly with all fields populated
  • Test with and without organization logo
  • Test with and without overdue charge
  • Test with and without customer notes
  • Test with multiple tax rate groups
  • Switch locale → verify labels appear translated
  • Create a new invoice → verify preview/download work after first save

Move PDF rendering from @react-pdf/renderer on the frontend to Typst
templates compiled on the Rust backend via typst-as-lib. The frontend
now sends pre-formatted JSON data to a generate_pdf Tauri command and
receives PDF bytes back, simplifying the rendering pipeline and
enabling future template customization through .typ files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant