Generate PDFs programmatically
Stop fighting with wkhtmltopdf. Use our reliable REST API to convert HTML, CSS, and URLs into pixel-perfect PDF documents in seconds.
Processed in memory — we don’t store your documents.
import requests
response = requests.post(
"https://api.headlesspdf.com/v1/generate-pdf",
headers={"X-API-Key": "YOUR_KEY"},
json={
"url": "https://example.com/invoice/1024",
"format": "A4"
}
)
# Save the PDF
with open("invoice.pdf", "wb") as f:
f.write(response.content)
Lightning Fast
Generate simple documents in under 3s. Our distributed clusters handle high concurrency effortlessly.
Developer Friendly
Simple JSON payload. No complex configurations. Works with Python, Node, PHP, Go, and more.
Secure & Private
We don't store your data. Documents are processed in memory and deleted immediately after delivery.
Integrate in Minutes
Choose your preferred language to see how easy it is.
import requests
response = requests.post(
"https://api.headlesspdf.com/v1/generate-pdf",
headers={"X-API-Key": "YOUR_KEY"},
json={
"url": "https://example.com/invoice/1024",
"format": "A4"
}
)
# Save the PDF
with open("invoice.pdf", "wb") as f:
f.write(response.content)
const response = await fetch("https://api.headlesspdf.com/v1/generate-pdf", {
method: "POST",
headers: {
"X-API-Key": "YOUR_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
url: "https://example.com/invoice/1024",
format: "A4"
})
});
const buffer = await response.arrayBuffer();
// Save the PDF (Node.js)
require("fs").writeFileSync("invoice.pdf", Buffer.from(buffer));
curl https://api.headlesspdf.com/v1/generate-pdf \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/invoice/1024",
"format": "A4"
}' \
--output invoice.pdf
require 'httparty'
response = HTTParty.post(
"https://api.headlesspdf.com/v1/generate-pdf",
headers: {
"X-API-Key" => "YOUR_KEY",
"Content-Type" => "application/json"
},
body: {
url: "https://example.com/invoice/1024",
format: "A4"
}.to_json
)
File.write("invoice.pdf", response.body, mode: "wb")
Frequently Asked Questions
Everything you need to know about the product.
Ready to start generating?
Sign up and save time, money and energy with HeadlessPDF.
View Pricing Plans