Screenshot to PDF API

Convert any URL to PDF or combine multiple screenshots into a single PDF document. Pixel-perfect rendering with full CSS, fonts, and JavaScript support via Chromium.

Start Free — 200 requests/month

URL to PDF vs Screenshot to PDF: Choosing the Right Approach

SnapAPI supports two distinct approaches to generating PDF documents from web content. The url-to-pdf approach calls the PDF endpoint with a target URL and returns a single PDF document rendered from that page, preserving the page's print stylesheet if one is defined, or rendering the screen stylesheet at print dimensions if no print stylesheet exists. This is the fastest approach for single-page documents and works well for invoices, receipts, and reports that live at a permanent URL. The screenshot-to-pdf approach first captures a full-page screenshot of the URL as a high-resolution PNG image, then embeds that image in a PDF document using a PDF generation library. This approach produces PDF files that look exactly like the web page as rendered in a browser, including all visual styling, gradients, and shadows that might not survive PDF rendering, and is better suited for creating visual archives, sending screenshot evidence as PDF attachments, or generating PDF portfolios of web pages for client deliverables.

Generating PDFs from Multiple Screenshots

For multi-page PDF documents, capture a screenshot of each source page and combine them into a single PDF using Python's reportlab or img2pdf library. This pattern is useful for creating client reports that combine screenshots of multiple dashboard pages, generating evidence packages that document a sequence of web pages visited during a research task, or producing design review documents that show multiple page designs side by side. Capture each screenshot in the correct order, save each to a temporary file, then pass the list of image files to img2pdf to combine them into a single PDF with one image per page at the original image dimensions. For high-quality output, capture screenshots at double the normal resolution by setting the device_scale_factor parameter to 2, then rescale the screenshots to standard print dimensions when embedding them in the PDF to produce a sharp, print-ready document.

import requests, img2pdf, tempfile, os

API_KEY = "your_api_key"

def url_to_screenshot(url, scale=2):
    r = requests.get(
        "https://api.snapapi.pics/screenshot",
        params={"url": url, "format": "png", "full_page": "true",
                "width": "1440", "device_scale_factor": str(scale)},
        headers={"Authorization": f"Bearer {API_KEY}"}
    )
    r.raise_for_status()
    return r.content

def screenshots_to_pdf(urls, output_path):
    tmp_files = []
    try:
        for url in urls:
            img = url_to_screenshot(url)
            tf = tempfile.NamedTemporaryFile(suffix=".png", delete=False)
            tf.write(img)
            tf.close()
            tmp_files.append(tf.name)
        with open(output_path, "wb") as f:
            f.write(img2pdf.convert(tmp_files))
        print(f"PDF saved: {output_path} ({os.path.getsize(output_path):,} bytes)")
    finally:
        for f in tmp_files:
            os.unlink(f)

urls = [
    "https://example.com/page1",
    "https://example.com/page2",
    "https://example.com/page3",
]
screenshots_to_pdf(urls, "output.pdf")

PDF Output Quality and Size Optimization

Screenshot-based PDFs tend to be larger than HTML-rendered PDFs because they contain rasterized image data rather than vector text and shapes. A full-page screenshot of a typical web page at 2x device scale and 1440px viewport width produces an image of roughly three to eight megabytes, which translates to a similar-sized PDF page. For documents that need to be emailed or downloaded quickly, optimize the screenshots before embedding them in the PDF by converting them to JPEG format at 85 percent quality, which reduces file size by sixty to eighty percent with minimal perceptible quality loss for most web page content. Use the format=jpeg parameter in the SnapAPI screenshot call and specify quality=85 to get compressed output directly from the API without a post-processing step. For documents where text readability matters more than file size, such as legal evidence packages, keep the PNG format for lossless quality and use PDF compression options in your PDF generation library to reduce the file size without quality degradation.

Use Cases for Screenshot-Based PDF Generation

Design agencies generating client deliverables use screenshot-to-PDF workflows to produce design review documents that show each page design as it appears in the browser, combined into a single PDF for the client to annotate and approve. Digital marketing teams generate competitive intelligence reports by capturing screenshots of competitor landing pages, ad pages, and pricing pages, combining them into a weekly PDF report distributed to the sales and product teams. Legal teams documenting web evidence capture screenshots of web pages as part of a case file, combining related pages into a single PDF exhibit with page numbers and timestamps for court submission. E-commerce teams generate product catalog PDFs from their own product pages by capturing screenshot thumbnails of each product page and arranging them in a grid layout using reportlab, producing a printable catalog automatically from the live website without a separate print design workflow. Compliance teams generate visual audit reports by capturing screenshots of regulated pages at each audit date, combining them into a chronological PDF that documents the state of the pages at each snapshot point.

Get Started with SnapAPI PDF Generation

Register at snapapi.pics/register for a free API key with two hundred requests per month. The PDF endpoint is available on all plans and converts any URL to a PDF in a single API call. For screenshot-to-PDF workflows, the screenshot endpoint with full_page=true provides the high-quality source images, and open-source Python libraries like img2pdf, reportlab, and fpdf2 handle the PDF assembly. The SnapAPI documentation at snapapi.pics/docs includes examples for both the native PDF endpoint and the screenshot-plus-PDF-assembly pattern for multi-page document generation.

Adding Bookmarks and Table of Contents to Screenshot PDFs

Multi-page PDFs generated from screenshots benefit from a table of contents and named bookmarks that allow readers to navigate between sections without scrolling through every page. Use Python's reportlab library rather than img2pdf when you need to add bookmarks, page numbers, or a cover page to the combined screenshot PDF. Reportlab's Canvas API allows you to embed each screenshot image as a page, overlay a transparent text layer with the page URL or section title in a small font at the bottom of each page, and add an outline entry for each page using the bookmarkPage and addOutlineEntry methods. The result is a professional PDF document where each screenshot page has a named bookmark visible in the PDF reader's navigation panel, making it easy to jump directly to a specific page in a large multi-URL PDF report. Add a cover page with the report title, generation date, and list of included URLs using reportlab's Paragraph and SimpleDocTemplate to complete the document structure.

Automated PDF Report Generation Workflows

Automated PDF report generation workflows that use screenshot-to-PDF conversion typically run on a schedule and deliver the generated PDF to recipients via email or upload it to a shared storage location. Common patterns include weekly competitive intelligence reports that capture screenshots of competitor pages and combine them into a single PDF sent to the sales team every Monday morning, monthly compliance snapshots that capture screenshots of regulated pages and store them as dated PDF exhibits in a document management system, and on-demand client reports that capture screenshots of specified URLs and generate a branded PDF document when a user requests an export from your application. For scheduled PDF generation, use a cron job or a task queue worker that constructs the URL list from your database, calls SnapAPI for each screenshot, assembles the PDF, and delivers it via your email service or uploads it to S3 with a pre-signed URL that expires after forty-eight hours. Log each PDF generation event with the timestamp, URL list, file size, and delivery status for audit and debugging purposes.

Screenshot PDF Quality Checklist

Before deploying a screenshot-to-PDF workflow in production, verify these quality factors with real representative URLs. First, check that full-page screenshots capture the complete page content without cutting off below-the-fold sections: some pages use lazy loading that requires a scroll event to trigger content loading, which SnapAPI can handle by setting the scroll parameter to true before capturing. Second, verify that the Chromium renderer has loaded all web fonts before the screenshot is taken by setting the delay parameter to at least five hundred milliseconds for pages that use custom web fonts, which load asynchronously after the initial page render. Third, check that cookie consent overlays and subscription prompts are not covering the page content in the screenshot, which can be handled by passing dismiss_dialogs=true or by using CSS to hide known overlay selectors. Fourth, verify that the screenshot dimensions match the intended PDF page dimensions to avoid scaling artifacts: for standard A4 PDF pages in portrait orientation, a viewport width of 794 pixels at one-to-one scale produces screenshots that map cleanly to A4 dimensions when embedded in reportlab without resizing.