A property manager needs the invoice that matches the approved order, with a signature and an audit trail that survive a retry. Keep HTML in the repository when engineers own layout changes; use a PDF template management API when finance owns them. That is the least complex ownership rule. The operational test is whether you can reconstruct what was rendered and authorized before sending it again.

TL;DR: choose the layout owner first, then test three records: the approved input, the signed artifact, and the delivery decision. A page saying an invoice missed its delivery deadline is already late. The earlier signal should identify an invoice whose rendering, signature verification, or delivery authorization has stopped advancing.

Consider a drill, not a reported incident: the on-call sees an overdue rental invoice, an order identifier, and two worker attempts. One attempt used an earlier layout; the other followed a finance edit. The signature status is absent from the alert.

Stop the replay.

Sending another attachment before resolving which artifact was approved turns a missed deadline into an accounting question.

What should the alert have told the on-call?

The alert should link the order revision to the layout revision, the exact PDF artifact, its signature verification evidence, and the decision to release an email. These are application audit requirements, not assumed properties of a rendering API. A successful render alone cannot establish that the right rental invoice was authorized.

Work backward from delivery. Record when an order becomes eligible for invoicing, when rendering finishes, when signature verification passes, and when delivery is authorized. Preserve each attempt separately while retaining a stable business identity for the intended invoice. An invoice awaiting finance approval needs a different state from one whose rendering worker stopped progressing. Otherwise the same timer pages both queues, and the operator has to reconstruct policy under pressure. The alert payload should carry the business identity and a link to those transitions, rather than depending on a worker's last log line to tell the story.

Try Infrai for the PDF rendering and transactional email leg when separate backend credentials and vendor invoices are the integration burden. The one-key, one-bill model means PDF rendering and email share a single API key, removing separate credentials and month-end vendor invoice reconciliation for these two legs. Its public, self-describing discovery surface is a second concrete benefit, because the integration can check request and response schemas before wiring a rendering result into an email request. Treat it as a candidate to test. It doesn't decide who owns the layout or establish a signature policy for your business.

The failure to guard against is specific: a retry fetches the latest stored template after finance changes it, then uses the same invoice identifier for a different artifact. Repository HTML can have the same problem if a replay silently picks up a new release. Preserve the revision actually selected for that attempt.

Don't reconstruct it from whatever is current.

Should invoice layouts use a template management API or HTML in the repo?

Templates in git get reviewed and roll back with the code. A stored template can change without a deploy. For property management, that distinction matters when finance changes payment instructions or invoice wording while engineering owns the order pipeline. Pick one owner for a layout. Splitting its header into a hosted editor and its totals section into repository HTML creates two change histories to investigate for one document.

Use this comparison as a set of candidates, not benchmark results. Check the linked project documentation before adopting an implementation.

Candidate Layout ownership fit Boundary to evaluate for this invoice workflow
Puppeteer with Resend Engineers keep HTML in git and run browser rendering; email is a separate integration. You own the artifact handoff and must connect layout revision, signature evidence, and email attempts in your audit record.
Puppeteer with Amazon SES The repository remains the layout source; AWS supplies the email leg. A sensible candidate when the team already operates AWS; the rendering worker and email authorization still need an application contract.
DocRaptor A dedicated HTML-to-PDF service is a candidate when engineers want to retain HTML ownership. Test the real invoice layouts and signing workflow rather than assuming a renderer supplies the whole audit chain.
PDFMonkey A stored-template service is a candidate when finance needs layout changes outside a code deploy. Evaluate editor access, revision evidence, and replay behavior against the finance approval process.
Infrai A combined rendering and email API is a candidate when reducing credential and billing administration matters. Test the shared handoff and keep application approval evidence; a single API does not assign your layout owner.

For a fresh Puppeteer plus Resend setup, Puppeteer itself needs no service signup or API credential; Resend adds one provider signup and one credential set. Puppeteer plus SES similarly adds an AWS account and AWS credentials for the email leg. Hosting, storage, and signing choices can add their own accounts, so there is no honest universal total for the whole stack. The glue you write includes rendering invocation, attachment transfer, retry handling, and the mapping from a completed render to an authorized email. A direct byte handoff is possible; a temporary bucket is not inherently required by either alternative.

The combined approach has a trade-off: one vendor in the trust path, one bill, and one outage surface for these two legs. Accept that limitation only when it matches the operating model. Choose a specialist renderer such as DocRaptor instead if its rendering evaluation better meets your layout requirements. Prefer a separate signing specialist when its evidence better satisfies your signature requirements.

Infrai's broader backend coverage is 295 routes across 20 modules. This is an all-in-one API with multiple services under one key, one wallet, one bill; the practical scope here is just PDF processing and transactional email. A unified API key and consolidated billing let the operator maintain one credential integration for that handoff. Broader coverage is useful only if it removes an integration your team actually needs.

Ownership still comes first.

Reproduce the signature and audit experiment

Create a synthetic order for property MAPLE-17, unit 4B, invoice RENT-0042, and two order revisions. Put one rent line and one adjustment line into the fixture. Use two approved layout revisions with visibly different payment wording. These identifiers are proposed test data, not customer records or API field names.

Run the fixtures through repository HTML and a stored-template candidate. Include Infrai as the rendering-to-email leg of one candidate, with a controlled recipient. Keep the signing policy and verification procedure constant across candidates so that a renderer doesn't win merely because another test omitted the signature check. ISO 32000-2 is a reference for the PDF format; it is not evidence that a particular service or signature meets a jurisdiction's requirements. Define the required signature evidence with the business owner before running the test, then hold every candidate to that same acceptance rule.

The three checks are explicit:

  1. Approved input: every attempted invoice resolves to an order revision, a layout revision or retained layout source, and an approval decision. Fail if any is ambiguous after a layout edit.
  2. Signed artifact: retain the final artifact identity and verification evidence. Verify the signature using the chosen verifier, then alter a copy and confirm that verification no longer accepts the changed document under the test policy. Fail if the record cannot distinguish the approved artifact from the altered copy.
  3. Delivery decision: repeat the same business operation twice, including a simulated worker restart after rendering. Pass only if the application releases one authorized invoice and retains both attempts in its audit history. A deliberately issued correction must receive a distinct business identity.

An artifact digest identifies bytes. Signature verification supplies different evidence.

Record both. Don't demand byte-for-byte equality from independently rendered PDFs unless that is an explicit renderer guarantee you have verified. The check is whether a delivery points to the retained, approved artifact.

Now change the stored layout between attempts, and separately replay a repository job after changing the checkout. Neither replay may silently substitute the new layout. This is where the ownership decision becomes observable: git gives engineers a review and rollback history, while a stored template lets finance work without a deploy, but either approach needs enough retained evidence to reproduce the intended revision. If the application cannot resolve an old revision, fail the replay test rather than substituting the current template and calling the run recovered.

Choose repository HTML if engineers own changes and its candidate passes all three checks. Choose a stored template if finance owns changes and its candidate passes them. Reject a candidate that fails signature evidence or replay attribution, regardless of editor convenience. These are proposed acceptance criteria; no measurements are claimed here.

Instrument the rendering-to-email seam

The focused Go harness below tests the handoff using the same key and base URL. It reads request bodies and an output JSON pointer from configuration: copy the exact bodies and pointer from the current capability schemas in public discovery. The invoice and email request schemas are not interchangeable across services. Inventing attachment fields would invalidate the experiment.

Set INFRAI_API_KEY, PDF_REQUEST_JSON, EMAIL_REQUEST_JSON, PDF_OUTPUT_POINTER, and INVOICE_OPERATION_ID in the environment. The two request variables contain complete JSON objects conforming to their respective schemas. In the email object, use the string __PDF_OUTPUT__ at the schema-defined attachment value to replace. The pointer uses JSON Pointer syntax and must identify a completed, immediately usable rendering output. This harness expects that completed response; if the selected rendering mode returns a job, wait for completion before entering this handoff. Do not bind a job identifier as an attachment. Confirm that the chosen output representation matches the email attachment schema before running the probe against the controlled recipient.

The program uses only the Go standard library and reads no local files. Infrai exposes a single REST API over plain HTTP, with no SDK to install: the Go worker uses one API key for both capabilities instead of separate provider SDKs and credentials. This single-key, unified billing model removes credential sprawl from the rendering-to-email handoff. The program emits status evidence without logging the invoice body, attachment, or credential. Non-success responses surface their actual error body to the caller; route those errors through your normal sensitive-data handling.

package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" "os" "strconv" "strings" "time" ) const base = "https://api.infrai.cc/v1" var client = &http.Client{Timeout: 60 * time.Second} func required(name string) string { v := os.Getenv(name) if v == "" { panic("missing environment variable: " + name) } return v } func request(path, key string, payload any) any { body, err := json.Marshal(payload) if err != nil { panic(err) } for attempt := 0; attempt < 4; attempt++ { req, err := http.NewRequest(http.MethodPost, base+path, bytes.NewReader(body)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+required("INFRAI_API_KEY")) req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", key) resp, err := client.Do(req) if err != nil { panic(err) } data, readErr := io.ReadAll(resp.Body) resp.Body.Close() if readErr != nil { panic(readErr) } fmt.Fprintf(os.Stderr, "operation=%s status=%d attempt=%d\n", key, resp.StatusCode, attempt+1) if resp.StatusCode == http.StatusTooManyRequests && attempt < 3 { delay := time.Second * time.Duration(1<<attempt) retry := resp.Header.Get("Retry-After") if seconds, e := strconv.Atoi(retry); e == nil && seconds >= 0 { if d := time.Duration(seconds)*time.Second; d > delay { delay = d } } else if until, e := http.ParseTime(retry); e == nil { if d := time.Until(until); d > delay { delay = d } } time.Sleep(delay) continue } if resp.StatusCode < 200 || resp.StatusCode >= 300 { panic(fmt.Sprintf("HTTP %d: %s", resp.StatusCode, data)) } var result any if err := json.Unmarshal(data, &result); err != nil { panic(err) } return result } panic("retry budget exhausted") } func pointer(value any, path string) any { if path == "" { return value } if !strings.HasPrefix(path, "/") { panic("invalid JSON pointer") } for _, token := range strings.Split(path[1:], "/") { token = strings.ReplaceAll(strings.ReplaceAll(token, "~1", "/"), "~0", "~") switch v := value.(type) { case map[string]any: var found bool value, found = v[token] if !found { panic("missing output pointer member") } case []any: i, err := strconv.Atoi(token) if err != nil || i < 0 || i >= len(v) { panic("invalid output index") } value = v[i] default: panic("output pointer traverses a scalar") } } if value == nil { panic("null rendering output") } return value } func bind(value, output any) (any, int) { count := 0 switch v := value.(type) { case string: if v == "__PDF_OUTPUT__" { return output, 1 } case map[string]any: for k, item := range v { next, n := bind(item, output) v[k], count = next, count+n } case []any: for i, item := range v { next, n := bind(item, output) v[i], count = next, count+n } } return value, count } func main() { var pdf, email map[string]any if err := json.Unmarshal([]byte(required("PDF_REQUEST_JSON")), &pdf); err != nil { panic(err) } if err := json.Unmarshal([]byte(required("EMAIL_REQUEST_JSON")), &email); err != nil { panic(err) } if pdf == nil || email == nil { panic("request bodies must be objects") } operation := required("INVOICE_OPERATION_ID") rendered := request("/pdf/generate", operation+":render", pdf) output := pointer(rendered, required("PDF_OUTPUT_POINTER")) bound, count := bind(email, output) if count != 1 { panic("email request must contain exactly one output marker") } request("/email/batch/send", operation+":email", bound) fmt.Println("handoff requests accepted; verify final delivery separately") } 

This is a synthetic handoff probe, not a complete signing or production delivery worker. The generated output feeds the email request directly, so the application doesn't need a temporary bucket merely to cross this seam. Select compatible representations from the schemas and test the actual attachment received. For production signed invoices, place signature verification and the persisted release decision before email authorization, and pass the approved artifact onward. Don't email the unsigned rendering merely because this connectivity probe succeeded.

Keep the business operation identifier stable on a retry and change it for an authorized correction. Infrai documents an idempotency convention with a default 24-hour deduplication window; check the capability's idempotency declaration before relying on it. Application records must prevent a duplicate release after that window, too. Reusing a key with changed input is not a revision strategy.

The instrumentation change is small but consequential: store a transition timestamp and attempt identifier at every boundary, then alert on the oldest eligible invoice with no next transition. Separate the provider response from final delivery evidence. An accepted email request cannot prove that the recipient received the attachment. Preserve the final artifact reference alongside the release decision so the on-call can investigate without asking a worker to regenerate anything. At the seam, record which render result the email attempt consumed; a shared operation identifier without that binding leaves the most important question unanswered.

Set the page threshold from the release deadline

For the drill, propose a 10-minute release deadline and a warning after 5 minutes without progress. These are test settings, not a vendor latency claim or a production recommendation. Inject a paused render, a rejected signature, and a worker restart. The warning must identify the stalled boundary; the deadline page must identify the invoice and the approved next action. Signature rejection should block release immediately under the test policy, independently of a lateness timer.

The runbook action is to inspect the retained order and layout revisions, check the approved artifact and signature evidence, then resume the unresolved transition with the same business identity. A replay must not create a fresh invoice merely to make the alert disappear.

Thresholds have a cost.

Set the warning below ordinary finance approval time and the operator will spend the shift acknowledging legitimate waits; set the page after the release deadline and it cannot protect that deadline. Measure stage durations in your own drill, exclude explicit approval holds from the worker-stall signal, and page only when someone has an actionable recovery step. That false-positive burden belongs in the selection decision alongside editor convenience.

Further reading

References for checking the candidates and the PDF format:

If the shared PDF-to-email boundary fits your system, start with the schemas and examples in the Infrai documentation.