URL to PDF API

URL to PDF API

Convert any URL to a high-fidelity PDF with a single HTTP call. Full JavaScript rendering, custom paper formats, margins, and background printing — no headless browser setup required.

Get free API key →

100 calls/month free. No credit card.

One call. Any URL. Production-quality PDF.

Works from curl, Python, Node.js, or any HTTP client. No SDK required.

curl

# Basic A4 PDF
curl "https://snapapi.tech/v1/pdf?url=https://github.com" \
  -H "x-api-key: YOUR_KEY" \
  -o page.pdf

# Letter format, landscape, with background colors
curl "https://snapapi.tech/v1/pdf?url=https://github.com&format=Letter&landscape=true&print_background=true" \
  -H "x-api-key: YOUR_KEY" \
  -o landscape.pdf

# Custom margins (px) and reduced scale for dense content
curl "https://snapapi.tech/v1/pdf?url=https://github.com&margin_top=40&margin_bottom=40&scale=0.85" \
  -H "x-api-key: YOUR_KEY" \
  -o custom.pdf

Python

import requests

def url_to_pdf(url, output_path, fmt="A4", landscape=False):
    """Convert a URL to PDF and save to disk."""
    resp = requests.get(
        "https://snapapi.tech/v1/pdf",
        params={
            "url":              url,
            "format":           fmt,          # A4, Letter, A3, A5, Legal
            "landscape":       landscape,
            "print_background": True,
            "margin_top":       20,
            "margin_bottom":    20,
            "margin_left":      20,
            "margin_right":     20,
        },
        headers={"x-api-key": "YOUR_KEY"}
    )
    resp.raise_for_status()
    with open(output_path, "wb") as f:
        f.write(resp.content)
    print(f"Saved: {output_path} ({len(resp.content) // 1024}KB)")

url_to_pdf("https://github.com", "github.pdf")
url_to_pdf("https://example.com", "landscape.pdf", landscape=True)

Node.js

const fs = require('fs');

async function urlToPdf(url, outputPath, options = {}) {
  const params = new URLSearchParams({
    url,
    format:           options.format    ?? 'A4',
    landscape:        options.landscape ?? 'false',
    print_background: 'true',
    margin_top:       options.marginTop ?? '20',
    margin_bottom:    options.marginTop ?? '20',
    scale:            options.scale     ?? '1',
  });

  const res = await fetch(`https://snapapi.tech/v1/pdf?${params}`, {
    headers: { 'x-api-key': process.env.SNAPAPI_KEY }
  });

  if (!res.ok) throw new Error(`PDF failed: ${res.status}`);
  fs.writeFileSync(outputPath, Buffer.from(await res.arrayBuffer()));
  console.log(`Saved: ${outputPath}`);
}

await urlToPdf('https://github.com', 'github.pdf');
await urlToPdf('https://docs.example.com', 'docs.pdf', { format: 'Letter', landscape: 'true' });

What developers use it for

Any workflow where "save as PDF" needs to happen automatically.

🧾

Invoice Generation

Render an invoice HTML template to a URL, call the PDF endpoint, attach the result to an email. No PDF library needed — Chromium handles all the layout.

📊

Report Exports

Turn any dashboard or analytics page into a PDF report on demand. Works with JavaScript-rendered charts — the browser waits for them to fully render before capturing.

🗄️

Web Archiving

Preserve live pages as PDFs for compliance, audit trails, or research. Each call captures the page exactly as rendered — not just the raw HTML source.

⚖️

Legal Documentation

Capture web pages as evidence or reference documents with accurate timestamps. The full rendered page — including images, styles, and JavaScript output — is preserved.

📎

Email Attachments

Generate PDF versions of confirmation pages, receipts, or terms documents on the fly and attach them to transactional emails without storing anything on disk.

Every PDF option you'll actually use

Passed as simple query parameters — no configuration files.

Paper formats

A4, A3, A5, Letter, Legal, and Tabloid. Passed as format=A4.

Landscape / portrait

Add landscape=true for wide layouts like spreadsheets, dashboards, or presentations.

Custom margins

Set margin_top, margin_bottom, margin_left, margin_right in pixels independently.

Background printing

print_background=true includes CSS background colors and images. Off by default — turn it on for branded reports and invoices.

Render delay

delay=2000 waits an extra 2 seconds before capturing. Useful for animated charts or lazy-loaded content.

Page scale

scale=0.8 shrinks content slightly — useful for fitting wide layouts onto A4 without horizontal clipping.

Simple, transparent pricing

PDF generation is available on Starter plans and above.

Free

$0
/ month, forever
  • 100 calls/month
  • Screenshots
  • Metadata extraction
  • Page analysis
Get free key

Pro

$29
/ month
  • 5,000 calls/month
  • Everything in Starter
  • Batch processing (25)
  • 20 monitors
  • 30-day snapshot history
Upgrade to Pro

Business

$99
/ month
  • 25,000 calls/month
  • Everything in Pro
  • Batch processing (50)
  • 100 monitors
  • 90-day snapshot history
Upgrade to Business

Frequently asked questions

Does the PDF include CSS styles and JavaScript-rendered content?

Yes. Every PDF request runs a full Chromium browser session, navigates to the URL, waits for the page to reach networkidle2 (all resources loaded, no pending network activity), and then generates the PDF. Charts rendered by JavaScript libraries, images loaded lazily, and CSS-in-JS styles are all captured correctly. Add delay=2000 if your page has animations or slow-loading assets that need extra time to settle.

Is there a file size limit on the generated PDFs?

There is no hard file size limit on the output PDF. Very long pages (think full documentation sites or long-form reports) will produce correspondingly large PDF files. If you need to reduce file size, use scale=0.8 to shrink the content slightly, or use print_background=false to omit large background images. The request timeout is 45 seconds — pages that take longer than that to fully render will return a timeout error.

Can it generate PDFs from password-protected or authenticated pages?

Not directly. The API visits URLs as an unauthenticated browser — it cannot log in to pages that require credentials. The workaround is to render authenticated content to a temporary public URL (common for invoice and report generation platforms) and then call the PDF endpoint on that URL. Alternatively, use the POST /v1/render endpoint to send raw HTML directly — this works well for server-rendered invoices and reports where you already have the authenticated content server-side.

What's the rate limit on PDF generation?

PDF calls count against your monthly API quota exactly like screenshot or metadata calls — one call per PDF. Rate limits are the same as other endpoints: 1 concurrent request on Free, 2 on Starter, 3 on Pro, 5 on Business. There is no separate per-minute rate limit. If you need to generate many PDFs in a short window, upgrade to a higher concurrency tier or stagger your requests with a short delay between them.