Use Case

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

Convert any URL to PDF
Generate invoices and reports
Archive web content
Create printable documents

Results You Can Expect

< 5s
average PDF generation time
100%
CSS fidelity
Any size
document length supported

How It Works

1

Build your document as a web page (invoice, report, certificate)

2

Apply print-friendly CSS for optimal PDF rendering

3

Call the Screenshotly API with format: "pdf" and fullPage: true

4

Receive the PDF binary and serve or store as needed

5

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