Skip to main content
Use Create PDF async when you want to acknowledge a request before the PDF is ready. The API returns a job ID. Save that ID with your app’s report so you can look up its result later.

Queue the PDF

With Node.js 24, install the Doczilla Node SDK and Express with npm 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
The SDK encodes the HTML for you. A newly queued job returns PENDING.

HTML

Save the HTML below as weekly-summary.html.
weekly-summary.html

Receive and store the result

Save this as receive-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
The signed payload’s 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.URL and download fileUrl promptly after verifying the webhook. The URL expires after an hour.
See Webhook options and Securing your webhook.