PDF Generation
Convert any web page or URL to a pixel-perfect PDF via API. Handles modern CSS, JavaScript rendering, and full-page capture.
Overview
Need to turn a URL into a PDF? Screenshotly converts any web page to a perfectly formatted PDF document using a real browser engine — no stripped styles, no broken layouts.
Unlike lightweight HTML-to-PDF converters that choke on flexbox, grid, web fonts, or client-side JavaScript, our API renders pages in a full Chromium instance. The PDF output matches exactly what you see in the browser. Pass any public or authenticated URL and receive a production-ready PDF.
Full-page capture ensures the complete document is included, not just the visible viewport. Control margins, page size (A4, Letter, custom), and orientation through API parameters or CSS @page rules. Use this for archiving web content, generating printable versions of articles, or building document pipelines that convert any URL to PDF on demand.
Key Benefits
Results You Can Expect
How It Works
Build your document as a web page (invoice, report, certificate)
Apply print-friendly CSS for optimal PDF rendering
Call the Screenshotly API with format: "pdf" and fullPage: true
Receive the PDF binary and serve or store as needed
Implement retry logic for large documents that may take longer
Code Example
// Generate PDF
const response = await fetch('https://api.screenshotly.app/screenshot', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://your-app.com/invoice/123',
format: 'pdf',
fullPage: true,
}),
});Frequently Asked Questions
What CSS properties work best for PDF output?
Use @media print styles for PDF-specific formatting. Avoid CSS columns and complex flexbox nesting. Fixed-width layouts (e.g. 800px) produce the most predictable results. Set page-break-inside: avoid on important sections.
Can I control PDF page size and orientation?
Yes. The API renders the full page into a single continuous PDF by default. Use CSS @page rules in your source HTML to control page size and orientation. Landscape is useful for wide dashboards.
How does PDF generation differ from a regular screenshot?
PDF output uses the same rendering engine but produces a vector-friendly document instead of a raster image. Text remains selectable and searchable. File sizes are typically smaller than equivalent PNG screenshots for text-heavy pages.
What's the maximum page length for PDF generation?
There is no hard page-length limit. The API captures the full scrollable content and converts it into a multi-page PDF. Very long pages (50,000+ pixels) may take a few extra seconds to process.
Want a step-by-step walkthrough?
Read: PDF Generation Complete Guide →Ready to automate pdf?
Get started with 100 free screenshots. No credit card required.
Related Use Cases
Thumbnails
Generate thumbnail previews for link aggregators, directories, and bookmarking services. Create visual previews at any size.
Link Previews
Build link preview services for messaging apps, social platforms, and content aggregators. Generate rich previews for any URL.
Invoices & PDFs
Generate pixel-perfect PDF invoices, receipts, and billing documents from HTML templates. Automate your financial document pipeline.