Queue the PDF
With Node.js 24, install the Doczilla Node SDK and Express withnpm install @doczilla/node express.
Save this as queue-pdf.mjs alongside weekly-summary.html. Set DOCZILLA_API_KEY and DOCZILLA_WEBHOOK_URL
to your server-side API key and the public HTTPS URL for the receiver below. This example uses WebhookOptions.receiveType.BASE64
so the receiver can store the PDF without a second download.
queue-pdf.mjs
PENDING.
HTML
Save the HTML below asweekly-summary.html.
Weekly summary HTML
Weekly summary HTML
weekly-summary.html
Receive and store the result
Save this asreceive-pdf.mjs. Keep DOCZILLA_API_KEY
in the environment to initialize the SDK and set DOCZILLA_WEBHOOK_SECRET
to the webhook secret in your organization settings. Start node receive-pdf.mjs and expose its /webhooks/doczilla
route over HTTPS before submitting the job.
The receiver uses the raw request body for the same signature check
as the webhook security example. It then saves the PDF by job ID.
receive-pdf.mjs
id is the ID returned by the queue request. When a row with that ID exists in renders,
your app can mark the report ready and serve the saved PDF.
The primary key makes saving the result atomic even if the same webhook is delivered twice.
Both deliveries receive 204 once the result is stored.
Handle a missing result
- The queue request returns an error. Keep the report in an error state. If the request timed out, check whether a job was created before submitting again.
- The job stays pending in your app. Set an application deadline and check the job by ID in the Doczilla dashboard. A render can fail before reaching the completion webhook. The dashboard also distinguishes render failures from delivery failures.
- The PDF is too large for the receiver. Use
WebhookOptions.receiveType.URLand downloadfileUrlpromptly after verifying the webhook. The URL expires after an hour.