URLSnap's PDF API converts any publicly accessible URL to a pixel-perfect PDF using a real headless Chromium browser. No wkhtmltopdf, no Puppeteer to host, no server to maintain — just a single GET request.
curl "https://urlsnap.dev/api/pdf?url=https://example.com&apiKey=YOUR_KEY" \
--output page.pdf
That's it. Open page.pdf and you'll see a rendered PDF of the page, with JavaScript executed and CSS applied.
// Node.js — save a URL as PDF
const fs = require('fs');
async function urlToPdf(url, outputPath) {
const apiKey = 'YOUR_API_KEY';
const endpoint = `https://urlsnap.dev/api/pdf?url=${encodeURIComponent(url)}&apiKey=${apiKey}&format=A4`;
const res = await fetch(endpoint);
if (!res.ok) throw new Error(`API error: ${res.status}`);
const buffer = Buffer.from(await res.arrayBuffer());
fs.writeFileSync(outputPath, buffer);
console.log(`Saved PDF: ${outputPath}`);
}
urlToPdf('https://example.com', 'output.pdf');
# Python — save a URL as PDF
import requests
from urllib.parse import quote
def url_to_pdf(url, output_path):
api_key = 'YOUR_API_KEY'
endpoint = (
f"https://urlsnap.dev/api/pdf"
f"?url={quote(url)}&apiKey={api_key}&format=A4"
)
response = requests.get(endpoint)
response.raise_for_status()
with open(output_path, 'wb') as f:
f.write(response.content)
print(f"Saved PDF: {output_path}")
url_to_pdf('https://example.com', 'output.pdf')
<?php
// PHP — save a URL as PDF
function urlToPdf($url, $outputPath) {
$apiKey = 'YOUR_API_KEY';
$endpoint = 'https://urlsnap.dev/api/pdf?url='
. urlencode($url)
. '&apiKey=' . $apiKey
. '&format=A4';
$pdf = file_get_contents($endpoint);
if ($pdf === false) throw new Exception('API request failed');
file_put_contents($outputPath, $pdf);
echo "Saved PDF: {$outputPath}\n";
}
urlToPdf('https://example.com', 'output.pdf');
// Go — save a URL as PDF
package main
import (
"fmt"
"io"
"net/http"
"net/url"
"os"
)
func urlToPDF(targetURL, outputPath string) error {
apiKey := "YOUR_API_KEY"
endpoint := "https://urlsnap.dev/api/pdf?url=" +
url.QueryEscape(targetURL) +
"&apiKey=" + apiKey + "&format=A4"
resp, err := http.Get(endpoint)
if err != nil { return err }
defer resp.Body.Close()
file, _ := os.Create(outputPath)
defer file.Close()
io.Copy(file, resp.Body)
fmt.Printf("Saved PDF: %s\n", outputPath)
return nil
}
Render your HTML invoice template as a PDF. Perfect for billing systems and automated reports.
Save articles, documentation pages, or web content as PDFs for offline storage or distribution.
Let users export any page of your web app as a print-ready PDF — no browser print dialog needed.
Capture analytics dashboards, reports, or data visualizations as PDFs for sharing with stakeholders.
Convert HTML contract templates to PDF before sending them to e-signature services.
Export documentation pages to PDF for users who prefer offline reading or printing.
GET https://urlsnap.dev/api/pdf
# Required
url=https://example.com # URL to convert to PDF
apiKey=YOUR_API_KEY # from urlsnap.dev/#get-key
# Optional
format=A4 # A4 (default), Letter, Legal, A3, A5, Tabloid
landscape=true # landscape orientation (default: portrait)
delay=2000 # wait N ms after page load (for JS-heavy pages)
delay=2000 or higher if your page loads data asynchronously via JavaScript. The API will wait for the specified time before generating the PDF, ensuring all content is rendered.
wkhtmltopdf is popular but uses an old WebKit engine that doesn't support modern CSS (Grid, Flexbox, CSS Variables) or JavaScript properly. Pages that look great in Chrome often look broken in wkhtmltopdf.
URLSnap uses headless Chromium — the same engine as Google Chrome — so your PDFs look exactly like they do in a browser: modern layouts, web fonts, CSS animations, and JavaScript-rendered content all work correctly.
@media print rules are applied)Free tier: 20 requests/day, no credit card required. Takes 30 seconds to get your API key.
Get Free API Key See All PlansYes. URLSnap uses a real Chromium browser, so React, Vue, Angular, and other SPA frameworks render correctly. If your page loads data asynchronously, add ?delay=2000 to wait for the content to appear.
URLSnap fetches pages as a regular browser would. For public pages it works immediately. For pages requiring login, you'd need to provide a URL that includes an auth token or uses a shareable/public endpoint.
By default, PDFs are A4 portrait. You can change the format with ?format=Letter, ?format=A3, etc. Use ?landscape=true for landscape orientation.
Yes — URLSnap is just an HTTP API call. No binaries to install, no system dependencies. Works in any environment that can make outbound HTTP requests.
There's a soft concurrency limit to keep the service stable. For high-volume or burst workloads, the Pro plan ($29/mo) is recommended. Contact support for custom arrangements.