Add invoice-pdf-template: HTML-to-PDF invoices with R2 and KV - #1144
Open
danmolitor wants to merge 2 commits into
Open
Add invoice-pdf-template: HTML-to-PDF invoices with R2 and KV#1144danmolitor wants to merge 2 commits into
danmolitor wants to merge 2 commits into
Conversation
Renders invoice PDFs inside the Worker with @formepdf/html (Rust layout engine compiled to WASM, web target, explicit init), stores the bytes in R2, and indexes invoice metadata in KV so the list persists. Plain static form UI served by Workers Assets; Hono routes for render, list, fetch and delete. Includes 10 vitest-pool-workers tests that exercise the real engine and bindings in workerd, a Playwright smoke spec, and a README that states the Workers Paid plan requirement (a render costs ~20 ms CPU, above the Free plan's 10 ms cap) and the measured cold/warm numbers. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ELyDw6a7bYVMdsMtAdj4YJ
0.20.1 fixes the worker entry's result shape (the layout-pass count declared in the package's types is now actually returned in workerd). Lockfiles regenerated with the templates CLI; template tests pass in workerd and a wrangler dev render was verified against the pinned version. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019eLgo72VYmQp3kNz9PZDHs
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Adds
invoice-pdf-template: a Worker that renders invoice PDFs from HTML + print CSS using@formepdf/html(WASM in the isolate, no browser), stores them in R2, and indexes metadata in KV. Includes a form UI, a JSON API, and a vitest-pool-workers suite (10 tests, run in real workerd).No linked issue - this is a new template contribution.
Lockfiles were generated with the repo's
templatesCLI;templates lint,lint-npm-lockfiles, syncpack, and prettier pass locally. The dependency is pinned to@formepdf/html@0.20.1.Per CONTRIBUTING.md I've omitted
preview_image_url,preview_icon_url, andpublish- could a reviewer supply the image URLs? I have a 16:9 screenshot of the running template ready to attach.Checklist
-templatepackage.jsonis populated<!-- dash-content-start -->and<!-- dash-content-end -->to designate the Dash readme preview.gitignorefile existspackage.jsoncontains adeploycommandpackage.jsoncontainsprivate: trueand noversionfield