Web to PDF API

Generate high-quality PDFs from any web page with custom page sizes, headers, footers, and print styles.

The Agenty PDF API renders any URL through headless Chrome and returns a high-quality PDF. You control page size, orientation, margins, headers, footers, and whether to include background graphics or honour @media print CSS.

By default the API returns the PDF binary. Pass responseType: "url" to upload the file to our CDN and receive a hosted URL instead — convenient for emails, dashboards, and async pipelines.

Features

Use cases

API examples

Generate a PDF from a URL with cURLbash
curl -X POST https://api.agenty.ai/v1/pdf \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/report"
  }' \
  --output report.pdf
Generate a PDF and get a hosted URL instead of the binarybash
curl -X POST https://api.agenty.ai/v1/pdf \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/invoice",
    "pageSize": "A4",
    "margin": {"top": "20mm", "bottom": "20mm"},
    "header": "Invoice #12345",
    "responseType": "url"
  }'
Generate a PDF from a URL in Node.jsjavascript
const res = await fetch('https://api.agenty.ai/v1/pdf', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    url: 'https://example.com/report',
    responseType: 'url', // get a link instead of the buffer
  }),
});
const { url } = await res.json();
console.log('PDF URL:', url);
Generate a PDF from a URL in Pythonpython
import requests

res = requests.post(
    "https://api.agenty.ai/v1/pdf",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"url": "https://example.com/report"},
)
with open("report.pdf", "wb") as f:
    f.write(res.content)

How Agenty compares

FeatureAgentyDocRaptorPDFShiftHTML2PDF
URL to PDFYesYesYesYes
Custom headers/footersYesYesYesLimited
Page size controlYesYesYesLimited
Hosted URL responseYesLimitedYesNo
Free tierYesNoYesYes

Frequently asked questions

What is the Web to PDF API?

The Agenty PDF API converts any web page into a high-quality PDF. You can control page size, orientation, margins, headers, footers, and whether to include background graphics.

How do I get a URL instead of the PDF binary?

Pass responseType: "url" in your request body. The API uploads the generated PDF to our CDN and returns a hosted link in JSON — useful for emails, webhook-driven jobs, and async pipelines.

Can I add headers and footers?

Yes. Pass header and footer strings, with placeholders like {{pageNumber}} and {{totalPages}} for dynamic pagination.

Does it respect @media print CSS?

Yes. We apply @media print styles during rendering. You can also pass custom CSS via the customCss parameter to override styles before PDF generation.

Is there a free tier?

Yes. All accounts include free credits. Check our pricing page for details.

Web scraping with AI

Start scraping data from any website using the Agenty's web scraping agents with AI.

No credit card required
14-day free trial
Cancel anytime
Log inSign up