PDF API

Convert Webpages & HTML
to PDF Instantly

Turn any URL or raw HTML into a polished, print-ready PDF in a single API call. Perfect for invoices, reports, e-books, and documentation — without managing a headless browser.

200 free requests/month · No credit card · URL or raw HTML input
Capabilities

Professional PDFs from any web content.

Everything you need to generate print-quality PDFs without maintaining browser infrastructure.

URL or HTML Input

Pass a URL to capture a live webpage, or POST raw HTML for fully custom layouts — invoices, certificates, tickets — without a publicly accessible URL.

A4 & Letter Formats

Choose from A4, A3, Letter, Legal, or Tabloid. Switch between portrait and landscape. Set margins individually — top, right, bottom, left — in millimeters.

Headers & Footers

Inject custom HTML into the page header and footer for every page — company logo, document title, page numbers, date — using Chromium's native header template support.

Print Media CSS

Rendered with @media print stylesheets applied automatically. Your page's print layout is respected exactly as designed.

Clickable Links

All hyperlinks in the source HTML remain active in the generated PDF. Internal anchors, external URLs, and mailto links are all preserved.

Wait for JS Rendering

Dynamic React/Vue/Angular apps are fully rendered before PDF generation. Use wait_for or delay to capture charts and tables after data loads.

Code Examples

Generate PDFs in any language.

Replace YOUR_API_KEY with the key from your dashboard.

# Convert URL to PDF (A4, portrait)
curl -G "https://api.snapapi.pics/v1/pdf" \
  --data-urlencode "url=https://github.com" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --output page.pdf

# Convert raw HTML to PDF (invoice example)
curl -X POST "https://api.snapapi.pics/v1/pdf" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"html":"<h1>Invoice #1001</h1><p>Total: $250</p>","format":"A4","margin_top":"20mm"}' \
  --output invoice.pdf

# Landscape with custom margins
curl -G "https://api.snapapi.pics/v1/pdf" \
  --data-urlencode "url=https://example.com/report" \
  -d "landscape=true&margin_top=10mm&margin_bottom=10mm" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --output report-landscape.pdf
import SnapAPI from 'snapapi-js';

const client = new SnapAPI('YOUR_API_KEY');

// URL to PDF
const pdf = await client.pdf.generate({
  url: 'https://github.com',
  format: 'A4',
  landscape: false,
  margin_top: '15mm',
  margin_bottom: '15mm',
});

// HTML to PDF (invoice)
const invoice = await client.pdf.generateFromHTML({
  html: `<!DOCTYPE html>
  <html><body style="font-family:sans-serif">
    <h1>Invoice #1001</h1>
    <p>Amount due: $250.00</p>
  </body></html>`,
  format: 'A4',
});
from snapapi import SnapAPI

client = SnapAPI("YOUR_API_KEY")

# URL to PDF
pdf_bytes = client.pdf.generate(
    url="https://github.com",
    format="A4",
    landscape=False,
    margin_top="15mm",
    margin_bottom="15mm",
)

with open("output.pdf", "wb") as f:
    f.write(pdf_bytes)

# HTML to PDF (invoice)
html = """<!DOCTYPE html>
<html><body style="font-family:sans-serif">
  <h1>Invoice #1001</h1>
  <p>Amount due: $250.00</p>
</body></html>"""

invoice = client.pdf.generate_from_html(html=html, format="A4")
import "github.com/Sleywill/snapapi-go"

client := snapapi.New("YOUR_API_KEY")

buf, err := client.PDF.Generate(snapapi.PDFOptions{
    URL:          "https://github.com",
    Format:       "A4",
    Landscape:    false,
    MarginTop:    "15mm",
    MarginBottom: "15mm",
})
if err != nil { panic(err) }
os.WriteFile("output.pdf", buf, 0644)
$client = new SnapAPI\SnapAPI('YOUR_API_KEY');

$bytes = $client->pdf->generate([
    'url'           => 'https://github.com',
    'format'        => 'A4',
    'landscape'     => false,
    'margin_top'    => '15mm',
    'margin_bottom' => '15mm',
]);

file_put_contents('output.pdf', $bytes);
API Reference

PDF API parameters.

All parameters sent to GET /v1/pdf (URL) or POST /v1/pdf (HTML body).

ParameterTypeDefaultDescription
urlstringrequired*URL to convert. Use POST with html body instead for raw HTML.
htmlstringRaw HTML string (POST body). Mutually exclusive with url.
formatstringA4Page size: A3, A4, A5, Letter, Legal, Tabloid.
landscapebooleanfalseUse landscape orientation instead of portrait.
margin_topstring10mmTop margin, e.g. "15mm", "1cm", "0.5in".
margin_rightstring10mmRight margin.
margin_bottomstring10mmBottom margin.
margin_leftstring10mmLeft margin.
print_backgroundbooleantrueInclude background colors and images in the PDF.
delayinteger0Wait N milliseconds after load before capturing.
wait_forstringCSS selector to wait for before PDF generation.
Use Cases

PDF generation for every workflow.

From SaaS billing to legal archives — SnapAPI's PDF API handles the full spectrum.

SaaS Billing

Invoice & Receipt Generation

Render your invoice template as HTML, POST it to the API, and return the PDF to your customer in one request. No PDF library, no font embeds, no layout nightmares.

Analytics

Report & Dashboard Export

Let users export their dashboard or analytics charts as a PDF. Screenshot a live URL with wait_for to capture charts after data finishes loading.

Publishing

E-Books & Documentation

Convert your Markdown-generated documentation or blog posts to printable PDFs. Append a custom CSS stylesheet to control typography and page breaks.

Legal & Compliance

Web Page Archival

Archive web pages as legally admissible PDFs with rendered timestamps and URLs in the footer. Full-fidelity rendering preserves layout and images exactly as they appeared.

Pricing

Start free. Scale when you need to.

All plans include PDF, screenshot, scraping, extraction, and video. No feature gates.

Free
For personal projects and prototyping
$0/month
200 requests/month · No credit card
Get started free
  • 200 requests/month
  • All 6 capabilities
  • A4 / Letter / Landscape
  • URL + raw HTML input
Pro
For production apps at scale
$79/month
50,000 requests/month · ~$0.0016/req
  • 50,000 requests/month
  • All 6 capabilities
  • Highest priority queue
  • 3.3x cheaper than ScreenshotOne
Get started

Your first 200 PDFs are free.

No credit card. No setup. API key in under a minute.