Appearance
PDF Generation
Generate PDF documents from any URL.
Usage
Set format=pdf to get a PDF instead of an image:
bash
curl "https://api.urlpix.com/v1/screenshot?url=https://example.com&format=pdf" \
-H "X-API-Key: sk_live_YOUR_KEY" \
-o page.pdfOptions
PDF generation respects the same viewport parameters as screenshots:
bash
curl "https://api.urlpix.com/v1/screenshot?url=https://example.com&format=pdf&width=1440" \
-H "X-API-Key: sk_live_YOUR_KEY" \
-o wide.pdfJavaScript Example
javascript
const params = new URLSearchParams({
url: 'https://example.com',
format: 'pdf',
width: '1440',
})
const response = await fetch(
`https://api.urlpix.com/v1/screenshot?${params}`,
{ headers: { 'X-API-Key': 'sk_live_YOUR_KEY' } }
)
const pdfBlob = await response.blob()Node.js — Save to File
javascript
import fs from 'fs'
const response = await fetch(
'https://api.urlpix.com/v1/screenshot?url=https://example.com&format=pdf',
{ headers: { 'X-API-Key': process.env.URLPIX_API_KEY } }
)
const buffer = Buffer.from(await response.arrayBuffer())
fs.writeFileSync('output.pdf', buffer)Tips
- The
qualityparameter has no effect on PDF output fullPage=trueworks with PDF — the PDF will contain the entire scrollable page- PDFs are cached like other formats (TTL depends on your plan)