Render HTML to PDF
const url = 'https://necodoc.example.com/api/v1/render';const options = { method: 'POST', headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'}, body: '{"html":"example","css":"example","themeId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","header":{"html":"example","height":1,"firstPageHtml":"example"},"footer":{"html":"example","height":1,"firstPageHtml":"example"},"page":{"size":"Letter","orientation":"portrait","margins":{"top":20,"right":20,"bottom":20,"left":20}},"data":{},"filename":"example","partials":{"additionalProperty":"example"},"signers":[{"id":"example","role":"example","routingOrder":1,"name":"","email":""}],"output":{"pdfa":null,"pdfua":false,"certify":false,"lang":"en"},"translations":{"additionalProperty":{"additionalProperty":"example"}},"response":"pdf","async":false,"signing":true,"subject":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://necodoc.example.com/api/v1/render \ --header 'Content-Type: application/json' \ --header 'x-api-key: <x-api-key>' \ --data '{ "html": "example", "css": "example", "themeId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "header": { "html": "example", "height": 1, "firstPageHtml": "example" }, "footer": { "html": "example", "height": 1, "firstPageHtml": "example" }, "page": { "size": "Letter", "orientation": "portrait", "margins": { "top": 20, "right": 20, "bottom": 20, "left": 20 } }, "data": {}, "filename": "example", "partials": { "additionalProperty": "example" }, "signers": [ { "id": "example", "role": "example", "routingOrder": 1, "name": "", "email": "" } ], "output": { "pdfa": null, "pdfua": false, "certify": false, "lang": "en" }, "translations": { "additionalProperty": { "additionalProperty": "example" } }, "response": "pdf", "async": false, "signing": true, "subject": "example" }'HTML with Liquid (rendered with data), optional CSS, theme, header and footer bands, and page setup. output.lang is the document language: date, number and currency format for it, t looks text up in translations, and right-to-left languages lay out right to left. Logged in the generation log with source api.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”HTML (Liquid allowed) to render as a PDF.
object
object
object
object
object
object
object
object
PDF/A, PDF/UA, certification and the document language.
object
Tagged PDF/UA-1. HTML renders only: overlays and packets have no structure to tag.
Certify with the server’s certificate (PAdES, DocMDP: form filling and signing stay allowed).
The document language (BCP 47): date, number and currency formatting, translations, text direction, and the PDF language.
Per language, source text to its translation: { "fr": { "Invoice": "Facture" } }.
object
object
pdf returns the bytes; json returns the generation and a link.
Answer 202 with the generation id at once instead of waiting.
object
Provider JSON to include.
Keep the invisible anchor text in the PDF. false costs one more Chromium pass.
Put the PDF in provider JSON as base64 (DocuSign documentBase64).
DocuSign tabs by page coordinates, or by anchor string.
Who the document is about (an email, a customer number), for erasure.
Responses
Section titled “Responses”Rendered. response: pdf (default) returns the bytes; response: json returns the generation. With signing, the signing package.
object
Signed; works without a key for 1 hour.
/api/v1/generations/{id}/pdf, with a key.
The PDF’s signers and sign boxes, for an e-sign provider.
object
A signer, with name and email rendered from the data.
object
object
PDF points in the page’s user space, origin bottom-left (what pdf-lib uses).
object
Points (pixels at 72 dpi) from the top-left of the page as displayed (DocuSign, Dropbox Sign, Adobe Sign).
object
Fractions (0..1) of the displayed page, origin top-left.
object
Invisible text at the box’s top-left corner, for anchor-based tab placement. Null when the PDF has none.
object
Signed; works without a key for 1 hour.
/api/v1/generations/{id}/pdf, with a key.
Provider JSON, as asked for in formats.
object
DocuSign eSignature v2.1 envelope definition: POST it to /restapi/v2.1/accounts/{accountId}/envelopes.
object
Dropbox Sign signers and form_fields_per_document for /signature_request/send.
object
Adobe Acrobat Sign participantSetsInfo (POST /agreements) and formFields (PUT /agreements/{id}/formFields).
object
Example
{ "status": "success"}Headers
Section titled “Headers”The generation log entry.
Pages in the PDF.
Still queued or running (async, or the wait ran out). Poll the generation.
object
Example
{ "status": "queued"}Missing, unknown, revoked or expired key, or the key’s account is disabled.
object
object
Example generated
{ "error": "example", "code": "example", "fieldErrors": { "additionalProperty": [ "example" ] }, "generationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}The key lacks the scope, role, template or source address this call needs.
object
object
Example generated
{ "error": "example", "code": "example", "fieldErrors": { "additionalProperty": [ "example" ] }, "generationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Invalid request or data; fieldErrors lists each.
object
object
Example generated
{ "error": "example", "code": "example", "fieldErrors": { "additionalProperty": [ "example" ] }, "generationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Rate limit exceeded.
object
object
Example generated
{ "error": "example", "code": "example", "fieldErrors": { "additionalProperty": [ "example" ] }, "generationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Headers
Section titled “Headers”Seconds until the key may call again.