Create PDF async
Queue the creation of a PDF and call the webhook with the result.
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Page options, either provide the url
, html
or htmlTemplate
option.
URL to go to. Should include the scheme, e.g. https://
HTML to render. Needs to be base64 encoded!
HTML template to render. Needs to be base64 encoded!
Template data, only used in combination with page.htmlTemplate
.
When to consider waiting succeeds.
auto
our smart waiting option that can handle 90% of the cases.load
waits for the 'load' event.domcontentloaded
waits for the 'DOMContentLoaded' event.networkidle0
waits till there are no more than 0 network connections for at least500
ms.networkidle2
waits till there are no more than 2 network connections for at least500
ms.
An object containing additional HTTP headers to be sent with every request. All header values must be strings.
Use our build-in adblocker.
Whether or not to enable JavaScript on the page.
Cookies added to the page, Also accepted as string inside headers.cookie
.
Provide credentials for HTTP authentication
.
Color-scheme to set on the page.
Changes the CSS media type of the page.
Changes the timezone of the page. See ICU’s metaZones.txt for a list of supported timezone IDs.
Scales the rendering of the web page. Amount must be between 0.1
and 2
.
Whether to show the header and footer.
HTML template for the print header. Should be valid HTML (base64 encoded) with the following classes used to inject values into them:
date
formatted print datetitle
document titleurl
document locationpageNumber
current page numbertotalPages
total pages in the document
HTML template for the print footer. Has the same constraints and support for special classes as headerHtml
.
Set to true
to print background graphics.
Whether to print in landscape orientation.
Paper ranges to print, e.g. 1-5, 8, 11-13
.
If set, this takes priority over the width
and height
options.
The sizes of each format are as follows:
letter
8.5in x 11inlegal
8.5in x 14intabloid
11in x 17inledger
17in x 11ina0
33.1in x 46.8ina1
23.4in x 33.1ina2
16.54in x 23.4ina3
11.7in x 16.54ina4
8.27in x 11.7ina5
5.83in x 8.27ina6
4.13in x 5.83in
Sets the width of paper. You can pass in a number or a string with a unit.
Sets the height of paper. You can pass in a number or a string with a unit.
Give any CSS @page size declared in the page priority over what is declared in the width
or height
or format
option.
Set the PDF margins.
Hides default white background and allows generating pdfs with transparency.
Generate document outline. If this is enabled the PDF will also be tagged (accessible).
Generate tagged (accessible) PDF. This is experimental and will increase the size of the PDF.
Pre-signed url to upload the generated pdf/screenshot to. Should include the scheme, e.g. https://
Webhook to call when screenshot is generated.
The way this webhook wants to receive the result.
- When
URL
is used an temporary URL will be provided to download the file (the file will be automatically deleted after 1 hour). - When
base64
is used make sure your webhook can receive the size of the file!
The webhook's URL. Should include the scheme, e.g. https://
Method to use when calling the webhook.
An object containing additional HTTP headers to be sent with the webhook. All header values must be strings.
Additional metadata that will be inside the request when the webhook is called. All values must be strings. Max 1kB.
curl --request POST \
--url https://api.doczilla.app/v1/pdf/async \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"page": {
"url": "<string>",
"html": "<string>",
"htmlTemplate": "<string>",
"templateData": {},
"waitUntil": "auto",
"headers": {
"x-foo": "bar"
},
"adblock": true,
"javascript": true,
"cookies": [
{
"name": "<string>",
"value": "<string>",
"domain": "<string>",
"url": "<string>",
"path": "<string>",
"secure": true,
"httpOnly": true,
"sameSite": "Strict",
"expires": 123
}
],
"authentication": {
"username": "<string>",
"password": "<string>"
},
"colorScheme": "<string>",
"mediaType": "screen",
"timezone": "<string>"
},
"pdf": {
"scale": 1,
"displayHeaderFooter": true,
"headerHtml": "<string>",
"footerHtml": "<string>",
"printBackground": true,
"landscape": true,
"pageRanges": "1-5",
"format": "letter",
"width": "<string>",
"height": "<string>",
"preferCSSPageSize": true,
"margin": {
"top": "<string>",
"bottom": "<string>",
"left": "<string>",
"right": "<string>"
},
"omitBackground": true,
"outline": true,
"tagged": true
},
"storage": {
"preSignedUrl": "<string>"
},
"webhook": {
"receiveType": "URL",
"url": "<string>",
"method": "POST",
"headers": {},
"metadata": {}
}
}'
{
"id": "5KqYNUjbxRJ-rKbIeGsXo",
"status": "PENDING"
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
Page options, either provide the url
, html
or htmlTemplate
option.
URL to go to. Should include the scheme, e.g. https://
HTML to render. Needs to be base64 encoded!
HTML template to render. Needs to be base64 encoded!
Template data, only used in combination with page.htmlTemplate
.
When to consider waiting succeeds.
auto
our smart waiting option that can handle 90% of the cases.load
waits for the 'load' event.domcontentloaded
waits for the 'DOMContentLoaded' event.networkidle0
waits till there are no more than 0 network connections for at least500
ms.networkidle2
waits till there are no more than 2 network connections for at least500
ms.
auto
, load
, domcontentloaded
, networkidle0
, networkidle2
An object containing additional HTTP headers to be sent with every request. All header values must be strings.
Use our build-in adblocker.
Whether or not to enable JavaScript on the page.
Cookies added to the page, Also accepted as string inside headers.cookie
.
Cookie name.
Cookie value.
Cookie domain.
The request-URI to associate with the setting of the cookie. This value can affect the default domain, path, source port, and source scheme values of the created cookie. Should include the scheme, e.g. https://
Cookie path.
true
if cookie is secure.
true
if cookie is http-only.
Cookie SameSite type.
Strict
, Lax
, None
Cookie expiration date (UTC time in seconds, counted from January 1, 1970.), session cookie if not set.
Provide credentials for HTTP authentication
.
Color-scheme to set on the page.
Changes the CSS media type of the page.
screen
, print
Changes the timezone of the page. See ICU’s metaZones.txt for a list of supported timezone IDs.
Scales the rendering of the web page. Amount must be between 0.1
and 2
.
Whether to show the header and footer.
HTML template for the print header. Should be valid HTML (base64 encoded) with the following classes used to inject values into them:
date
formatted print datetitle
document titleurl
document locationpageNumber
current page numbertotalPages
total pages in the document
HTML template for the print footer. Has the same constraints and support for special classes as headerHtml
.
Set to true
to print background graphics.
Whether to print in landscape orientation.
Paper ranges to print, e.g. 1-5, 8, 11-13
.
If set, this takes priority over the width
and height
options.
The sizes of each format are as follows:
letter
8.5in x 11inlegal
8.5in x 14intabloid
11in x 17inledger
17in x 11ina0
33.1in x 46.8ina1
23.4in x 33.1ina2
16.54in x 23.4ina3
11.7in x 16.54ina4
8.27in x 11.7ina5
5.83in x 8.27ina6
4.13in x 5.83in
letter
, legal
, tabloid
, ledger
, a0
, a1
, a2
, a3
, a4
, a5
, a6
Sets the width of paper. You can pass in a number or a string with a unit.
Sets the height of paper. You can pass in a number or a string with a unit.
Give any CSS @page size declared in the page priority over what is declared in the width
or height
or format
option.
Set the PDF margins.
Hides default white background and allows generating pdfs with transparency.
Generate document outline. If this is enabled the PDF will also be tagged (accessible).
Generate tagged (accessible) PDF. This is experimental and will increase the size of the PDF.
Pre-signed url to upload the generated pdf/screenshot to. Should include the scheme, e.g. https://
Webhook to call when screenshot is generated.
The way this webhook wants to receive the result.
- When
URL
is used an temporary URL will be provided to download the file (the file will be automatically deleted after 1 hour). - When
base64
is used make sure your webhook can receive the size of the file!
base64
, URL
The webhook's URL. Should include the scheme, e.g. https://
Method to use when calling the webhook.
POST
, PUT
An object containing additional HTTP headers to be sent with the webhook. All header values must be strings.
Additional metadata that will be inside the request when the webhook is called. All values must be strings. Max 1kB.
Response
Id of the queued job.
Status of the job.
PENDING
, RUNNING
, FAILED
, COMPLETED
Was this page helpful?
curl --request POST \
--url https://api.doczilla.app/v1/pdf/async \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"page": {
"url": "<string>",
"html": "<string>",
"htmlTemplate": "<string>",
"templateData": {},
"waitUntil": "auto",
"headers": {
"x-foo": "bar"
},
"adblock": true,
"javascript": true,
"cookies": [
{
"name": "<string>",
"value": "<string>",
"domain": "<string>",
"url": "<string>",
"path": "<string>",
"secure": true,
"httpOnly": true,
"sameSite": "Strict",
"expires": 123
}
],
"authentication": {
"username": "<string>",
"password": "<string>"
},
"colorScheme": "<string>",
"mediaType": "screen",
"timezone": "<string>"
},
"pdf": {
"scale": 1,
"displayHeaderFooter": true,
"headerHtml": "<string>",
"footerHtml": "<string>",
"printBackground": true,
"landscape": true,
"pageRanges": "1-5",
"format": "letter",
"width": "<string>",
"height": "<string>",
"preferCSSPageSize": true,
"margin": {
"top": "<string>",
"bottom": "<string>",
"left": "<string>",
"right": "<string>"
},
"omitBackground": true,
"outline": true,
"tagged": true
},
"storage": {
"preSignedUrl": "<string>"
},
"webhook": {
"receiveType": "URL",
"url": "<string>",
"method": "POST",
"headers": {},
"metadata": {}
}
}'
{
"id": "5KqYNUjbxRJ-rKbIeGsXo",
"status": "PENDING"
}