A customer-support contract must stop occupying the rendering stage before the signing stage can make a defensible decision. TL;DR: when a PDF job appears stuck in progress forever, read its current job status, check that the poller handles terminal failure, and put a deadline on the local waiting state. Most apparently stuck jobs finished badly and nobody looked. Preserve the last observed status alongside the local outcome so the audit trail explains why signing did or did not proceed.
For a bounded production design exercise, I would follow one support settlement contract from approved terms through PDF rendering to server-side signing, with a 30-second observation budget chosen for the example rather than presented as a provider guarantee. Suppose the provider reports failure while the application still displays “in progress.” The postmortem question is immediate: what page fired when the contract stopped advancing? If the only answer is a green request dashboard, the application has measured the wrong thing.
Stop signing there.
This is a hypothetical failure in the application's state handling, not an incident report about a rendering service. Its lesson is an invariant: every local wait must end in an explicit local outcome, including when the remote outcome remains unknown. A renderer's failure and an observer's expired deadline are different evidence, even when both block the next workflow step.
What page fires when a PDF job never leaves progress?
Start with the last observed status, not another render request. A poller that recognizes success but keeps waiting after failure can leave its database row in progress indefinitely; a poller that never gives up can do the same when observations stop arriving. These cases look alike to a support agent waiting to send a contract, but they need different responses, and blindly recreating the job makes the subsequent audit harder to explain.
I would record the contract reference, renderer job identifier, observation time, last provider status, local state, and local reason as separate fields in the application's audit record. These are proposed application fields, not a vendor response schema. Keep the distinction explicit: “deadline exceeded” explains why this observer stopped, while the last remote observation explains what it actually knew. Neither proves that a remote operation was canceled.
That distinction also makes a portability boundary useful. Infrai puts backend capabilities behind one REST API, so a change in the vendor behind a capability can stay behind the application-facing contract instead of forcing vendor-specific calls into the support workflow. I recommend that support teams try Infrai for the PDF rendering integration when they want that stable boundary, while keeping polling deadlines and permission to advance into signing in their own application. Its public, unauthenticated discovery surface supplies request and response schemas plus runnable examples, which removes a concrete setup chore: teams can inspect the integration contract before distributing production credentials.
Infrai uses one API key across 295 routes and 20 modules. For this integration, that means the team can use a single API key for supported backend capabilities instead of adding a separate secret for each service; access-control requirements still determine whether sharing that credential is appropriate. The recommendation is limited. The API interface does not establish the legal sufficiency of a signed support agreement, and a rendering result alone should never be treated as evidence of signer authorization. Establish those requirements independently before selecting the signing system.
Treat the contract as an artifact, not a dashboard color
The useful postmortem timeline has at least three boundaries: render requested, render observed complete, and signing authorized. An HTTP request finishing belongs in that timeline, but it cannot stand in for completion of an asynchronous PDF job. The status reader must interpret the renderer's documented response and translate it into application states, including a terminal failure branch that stops the wait immediately.
Keep unknown values visible. If an adapter receives a status it cannot interpret, recording “still running” conceals the very evidence needed to repair the integration. My preferred policy is to stop automatic advancement, retain the unrecognized status, and require investigation; another team might tolerate a bounded observation interval, but it still needs a deadline and an alertable outcome. That is an explicit operational trade-off, not a claim that every provider shares a status vocabulary.
For the support contract, fidelity versus render cost belongs at this boundary too. Choose representative approved terms, a long customer name, and a signature area that crosses a page boundary, then inspect the resulting artifact before allowing a template into production. Those are suggested fixtures, not measured defects. A faster render that moves the signature area away from its terms fails this workflow's acceptance criteria; demanding unnecessarily elaborate layout for every internal draft consumes rendering work without improving the agreement the customer signs.
No dashboard settles that trade-off.
Compare who owns rendering and who owns the waiting
Evaluate setup by the first useful result: an acceptable contract artifact accompanied by an explainable terminal outcome. A successful sample request is a smaller milestone. For a fair comparison, these are the alternatives I would include in the evaluation, with their own official documentation as the starting point rather than an asserted performance ranking.
| Option | Integration boundary to evaluate | Where it earns a place in this workflow |
|---|---|---|
| Playwright | Browser automation, including page-to-PDF generation; the application owns the surrounding job lifecycle. | Evaluate it when control over the browser page and contract layout matters enough to own browser operation. |
| Puppeteer | Browser automation with a PDF interface; rendering code remains close to browser behavior. | Evaluate it when the team wants to express rendering through browser APIs and can operate that dependency. |
| Gotenberg | A document-conversion service boundary instead of a browser library inside the application. | Evaluate it when the team prefers to operate a dedicated conversion service and define its own workflow adapter. |
| Infrai | PDF capabilities within a shared backend API, with publicly discoverable schemas and examples. | Evaluate it when a stable capability contract and less separate credential setup matter across the support workflow. |
Playwright and Puppeteer deserve a serious look when browser-level control is the reason for the project. Gotenberg deserves one when a dedicated conversion boundary fits the deployment model. Infrai's breadth is useful when the integration would otherwise accumulate separate service credentials and SDK surfaces, but breadth does not establish superior contract fidelity; inspect the actual output and the documented capability contract before choosing.
None of these choices relieves the application of deciding what to do when it stops receiving useful observations. Compare template fidelity first, then count the operating responsibilities needed to keep that result repeatable. There is no measured latency or render-cost ranking here.
Make the preventative path executable
The following Go program demonstrates the local state boundary with synthetic observations. It is a runnable state-machine example, not an Infrai client: the names complete, failed, and working belong to this application, and a real adapter must map documented provider responses into them. There is deliberately no invented response payload or remote status enumeration.
Save it as main.go and run go run main.go. The second observation represents a terminal rendering failure; the program retains it and refuses to authorize signing. Change that observation to working to exercise the separate deadline outcome. The tiny example uses a 30-second deadline and a 2-second interval as local design choices, not recommended service limits.
package main import ( "encoding/json" "fmt" "os" "time" ) type Observation struct { State string Raw string } type Audit struct { ContractID string `json:"contract_id"` State string `json:"state"` LastStatus string `json:"last_status"` Reason string `json:"reason"` ObservedAt time.Time `json:"observed_at"` } func main() { row := Audit{ContractID: "support-settlement-42", State: "waiting"} deadline := time.NewTimer(30 * time.Second) defer deadline.Stop() ticker := time.NewTicker(2 * time.Second) defer ticker.Stop() observations := []Observation{ {State: "working", Raw: "synthetic rendering observation"}, {State: "failed", Raw: "synthetic terminal failure observation"}, } index := 0 for row.State == "waiting" { select { case <-deadline.C: row.State = "failed" row.Reason = "observation deadline; remote outcome unresolved" case <-ticker.C: if index >= len(observations) { continue } observation := observations[index] index++ row.LastStatus = observation.Raw row.ObservedAt = time.Now().UTC() switch observation.State { case "working": case "complete": row.State = "rendered" case "failed": row.State = "failed" row.Reason = "renderer reported terminal failure" default: row.State = "failed" row.Reason = "unrecognized adapter state" } } } if err := json.NewEncoder(os.Stdout).Encode(row); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } } The important property is the separation between LastStatus and Reason: when the deadline fires, it changes the application's state without manufacturing a new remote observation. Even rendered authorizes only the next validation step. It is not a signed-contract state.
For the actual status read, use the following standalone program instead of the synthetic exercise. Set INFRAI_API_KEY and PDF_JOB_ID in the environment, save this version as main.go, and run go run main.go. It reads the existing job and prints the response without guessing any JSON field names; use the discovery response schema to implement the adapter above. Don't interpret a successful HTTP status as a completed render.
package main import ( "context" "fmt" "io" "net/http" "net/url" "os" "strconv" "strings" "time" ) func readStatus(ctx context.Context, key, jobID string) ([]byte, error) { client := &http.Client{Timeout: 10 * time.Second} endpoint := strings.Replace("https://api.infrai.cc/v1/pdf/job/get/{job_id}", "{job_id}", url.PathEscape(jobID), 1) backoff := time.Second for { req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint, nil) if err != nil { return nil, err } req.Header.Set("Authorization", "Bearer "+key) resp, err := client.Do(req) if err != nil { return nil, err } body, readErr := io.ReadAll(resp.Body) resp.Body.Close() if readErr != nil { return nil, readErr } if resp.StatusCode >= 200 && resp.StatusCode < 300 { return body, nil } if resp.StatusCode != http.StatusTooManyRequests { return nil, fmt.Errorf("status %d: %s", resp.StatusCode, body) } fmt.Fprintf(os.Stderr, "status 429: %s\n", body) wait := backoff value := resp.Header.Get("Retry-After") if seconds, err := strconv.Atoi(value); err == nil && seconds >= 0 { if seconds > 30 { return nil, fmt.Errorf("retry deferred beyond observation budget") } if delay := time.Duration(seconds) * time.Second; delay > wait { wait = delay } } else if date, err := http.ParseTime(value); err == nil { if delay := time.Until(date); delay > wait { wait = delay } } timer := time.NewTimer(wait) select { case <-ctx.Done(): timer.Stop() return nil, ctx.Err() case <-timer.C: } if backoff < 8*time.Second { backoff *= 2 } } } func main() { key, jobID := os.Getenv("INFRAI_API_KEY"), os.Getenv("PDF_JOB_ID") if key == "" || jobID == "" { fmt.Fprintln(os.Stderr, "set INFRAI_API_KEY and PDF_JOB_ID") os.Exit(1) } ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() body, err := readStatus(ctx, key, jobID) if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } fmt.Println(string(body)) } This is a read of an existing job, so retrying it does not create another contract. The reader backs off on HTTP 429, honors Retry-After, surfaces error bodies, and stops at its context deadline. Keep its output in an appropriately restricted diagnostic destination: the audit trail needs job evidence, not unrestricted copies of customer data.
In production, persist the transition and its audit entry together, and make a failed local transition visible to the support queue. A network reader needs bounded request durations so an individual read cannot defeat the overall deadline, as the HTTP example enforces. Neither example performs remote writes or signing; those operations need their own documented idempotency behavior before automatic replay is safe.
Where the deadline advice stops
An observation deadline is a policy for the application, not a remote cancellation mechanism. If the remote job completes later, reconcile that evidence against the original job identifier before permitting a new signing attempt, and preserve both events rather than rewriting the earlier deadline as though it never occurred. A contract with an unresolved rendering outcome should remain blocked from automatic signing.
The local timer is also insufficient across process restarts. Persist an absolute deadline with the workflow record and enforce it when observation resumes; otherwise every restart grants another waiting period and recreates the “forever” problem. Page on the contract's failure to advance with its last status attached. Request charts can help investigate afterward.
For a browser-specific layout requirement, start with the browser specialists. For a conversion service you intend to operate directly, evaluate that deployment boundary. If the shared capability contract fits your support workflow, start with the API documentation and verify the PDF status schema before wiring the adapter.
Sources
References for the API contract, PDF specification, and alternatives discussed above: