Render a PDF document
POST/pdf-generator/render
For authentication provide the x-api-key
header. The development key is not usable for this endpoint.
The rendering time is currently limited to 25 seconds. If this mark is hit, you will receive a HTTP status code of 408.
The request body payload is limited to 6 MB. If you use too many inline pictures they can also be fetched from public URLs.
Request
Header attributes
content-typerequired
Only acceptable content type is application/json
.
Acceptrequired
Your application should accept application/pdf
.
Body attributes
template_htmlrequired
The HTML template you want to render into a
documentheader_templateoptional
The HTML template used as a header and will appear on every
page.footer_templateoptional
The HTML template used as a footer and will appear on every
page.pdf.orientationoptional
Possible values are landscape
and portrait
. Defaults to
portrait
pdf.scaleoptional
Scale of the document used. Range from 0.1 to 2. Defaults to
1
pdf.formatoptional
Format of the resulting document. A1 to A6 are supported,
defaults to A4.pdf.margin.topoptional
Top margin of the document. Number string ending in one of
the following units: mm
, in
, cm
, px
.pdf.margin.leftoptional
Left margin of the document. Number string ending in one of
the following units: mm
, in
, cm
, px
.pdf.margin.rightoptional
Right margin of the document. Number string ending in one
of the following units: mm
, in
, cm
, px
.pdf.margin.bottomoptional
Bottom margin of the document. Number string ending in
one of the following units: mm
, in
, cm
, px
.import requests
resp = requests.post("https://api.doqs.dev/v1/pdf-generator/render",
headers={"x-api-key":"your-api-key","content-type":"application/json"},
json={"template_html":"<html>Your template</html>"},
)
Response
In case of a successful request, the endpoint will return the bytes of the rendered pdf document.
Headers
content-type
The content type header will be set to application/pdf.x-submission-id
Id of the submission