What you send / POST /v1/pdf with html
Render an HTML string to PDF over an API
Send a complete HTML document in the request body and get the PDF bytes back in the response.
What it is for
The default path. Your application already builds the markup, usually from a template engine it already has, and this posts that string and receives a file. The response is the PDF itself rather than a job id, so there is nothing to poll and nothing to reconcile: the request either returns bytes or returns an error.
The request
Sent to POST /v1/pdf with html. Everything else on this page is what happens around it.
curl -X POST https://api.pdfpipe.xyz/v1/pdf \
-H "Authorization: Bearer $PDFPIPE_KEY" \
-H "Content-Type: application/json" \
-d '{
"html": "<!doctype html><html><body><h1>Invoice</h1></body></html>",
"options": { "format": "A4", "margin": "18mm" }
}' \
--output invoice.pdfThe actual limits
Read from the implementation rather than remembered, so these are the numbers the API enforces rather than the ones a roadmap intends.
- The HTML string is capped at 5 MB. That is the markup, not the rendered page: a document referencing ten megabytes of images is fine, a document with those images inlined as data URIs is not.
- Exactly one of html, url or template_id. Sending two is a 400 rather than a precedence rule you would have to remember.
- The document is metered on success. A render that fails is refunded, so a broken template does not cost you documents while you fix it.
What failure looks like
A payload over the ceiling returns 413 with payload_too_large and a message naming the limit. Invalid JSON returns 400. A document that renders but produces nothing useful, such as one whose entire content is drawn by a script that never ran, returns 200 with a valid and blank PDF, which is the failure mode worth designing against because nothing reports it.
When this is the wrong tool
When the page already exists at a public address and is the same for every reader. Posting a five megabyte string that a URL render could have fetched is bandwidth spent for nothing. It is also the wrong shape when you need dozens of documents at once, because each render is a separate round trip.
Frequently asked
Is render html available on the free plan?
Yes. There is no plan gate on this one: it behaves the same on the free plan as on every paid plan, and the only limit that applies is the monthly document allowance.
Where do these numbers come from?
The running implementation. Every figure on this page, from payload ceilings to per-plan limits, is what the API enforces today rather than what a specification says it should. If one of them is wrong, the API is the thing to believe.
Related capabilities
Options that come up in the same request, and one from each of the other groups.
Convert a URL to PDF with an API
Give an address instead of markup and the renderer fetches the page itself.
Store an HTML template and render it with data
Upload the markup once, then render it by id with a data object, so the template lives on the server rather than in every caller.
Set the PDF page size in an API request
Six named paper sizes, passed in the request options, with A4 as the default when nothing is given.
Print background colours and images in a PDF
Controls whether background colours and images survive into the PDF. On by default here, which is the opposite of a browser's own default.
Render many PDFs in one API call
Up to several hundred documents in one request, each stored and returned as a link, with per-item success or failure rather than one all-or-nothing result.
Password protect a generated PDF
Encrypts the output so a reader is asked for a password before the document opens.
Check API usage and remaining document quota
How many documents have been used this billing period, what the limit is, and what the plans are, all readable from the API rather than from a dashboard.
Everything the API does
The full list, grouped by which part of the request it belongs to.
API reference
The complete parameter documentation, including the parts with nothing interesting to say about them.
100 free documents a month, and a playground that runs a real render without a key.