Render a PDF
Supply exactly one of url or html. Returns application/pdf.
header_html and footer_html are Chromium print templates: they support the classes date, title, url, pageNumber and totalPages, which Chromium substitutes at print time.
Counts one render.pdf. A PDF may have at most 100 pages; a document that prints to more is refused with 422 pdf_too_long and nothing is counted. PDFs are never cached.
Request
- Base URL: https://api.ironfang.com/render
- URL: https://api.ironfang.com/render/v1/pdf
- Auth: HTTP bearer
Headers
Makes a synchronous render happen, and count, at most once. Any string up to 255 characters, remembered per account. The first request under a key is admitted and rendered as usual; a synchronous result is not kept, so the same request again under the key is a 409 idempotency_key_used and reserves nothing - send a new key to render again. A different request under a used key is a 409 idempotency_conflict. An identical request inside the cache window is still served from cache.
Request body
Example request
{
"actions": [
{
"selector": "#show-more",
"type": "click"
},
{
"selector": "#details",
"type": "wait_for_selector"
}
],
"css": ".chat-widget { display: none !important; }",
"script": "document.querySelector('#pricing')?.click();",
"page_ranges": "1-3, 5, 8-",
"paper_height": "297mm",
"paper_width": "210mm",
"success_rules": {
"fail_on_status": [
"4xx",
"5xx"
],
"forbid_text": [
"Sign in to continue"
],
"require_selector": "#invoice"
}
}Response
The rendered PDF.
Changes
No recorded changes to this operation across all 1 revision of this API.