Async mode

Async mode requires at least 1 webhook url configuration. You will need to set it up before using it.

Using async mode, your request will be queued in our priority queue system and it will be rendered in the background (which is faster & more efficient than sync mode).

When your PDF file is ready, we will send a webhook notification request to your configured URLs.

It is recommended to use Webhook because:

  • We handle the Rate Limiting for you under the hood => You will get your files eventually.

    • Using sync mode, you have to deal with that on your end.

  • Powered by our strong & powerful workers, your PDF files will be ready FASTER than sync mode.

  • We handle the Idempotency, to save your API usage.

Endpoint

POST https://renderpdf.io/api/pdfs/render-async

Content-Type

JSON or FormData.

Body

ParameterDescription

identifier (string - required)

The unique identifier of your PDF file, it will be included in the webhook request.

htmlContent (string - required)

The content that you want to render

headerHtmlContent (string - default: null)

The header of the PDF file (visible for pages)

footerHtmlContent (string - default: null)

The footer of the PDF file (visible for pages)

landscape (boolean - default: false)

Render in landscape or portrait

paperWidth (string|number - default: 8.5in)

Specify paper width using units like 72pt, 96px, 1in, 25.4mm, 2.54cm, or 6pc. Default unit is inches if unspecified.

paperHeight (string|number - default: 11in)

Specify paper height using units like 72pt, 96px, 1in, 25.4mm, 2.54cm, or 6pc. Default unit is inches if unspecified.

marginTop (string|number - default: 0.39in)

Specify top margin width using units like 72pt, 96px, 1in, 25.4mm, 2.54cm, or 6pc. Default unit is inches if unspecified.

marginLeft (string|number - default: 0.39in)

Specify left margin width using units like 72pt, 96px, 1in, 25.4mm, 2.54cm, or 6pc. Default unit is inches if unspecified.

marginRight (string|number - default: 0.39in)

Specify right margin using units like 72pt, 96px, 1in, 25.4mm, 2.54cm, or 6pc. Default unit is inches if unspecified.

marginBottom (string|number - default: 0.39in)

Specify bottom margin using units like 72pt, 96px, 1in, 25.4mm, 2.54cm, or 6pc. Default unit is inches if unspecified.

printBackground (boolean - default: false)

Print the background graphics.

scale (string|number - default: 1.0)

The scale of the page rendering.

Learn more about htmlContent, headerHtmlContent, and footerHtmlContent here

Available Error Responses

  • 422 when you have any invalid request data. E.g.: missing htmlContent, wrong scale number, etc.

  • 402 when you send the request with the same identifier within 1-minute time range.

Last updated