logo of Screenshot for Web
Free toolsPlaygroundDocsBlogPricing
LoginDashboard

Company

HomeFeaturesPricingBlogFacts

Screenshot Tools

Website ScreenshotsFull Page ScreenshotsScrolling ScreenshotsWebsite HistoryPDF Generation APIScreenshot API

Legal

Terms of UsePrivacy PolicyCookie PolicyCopyrightSecurity

Support

FAQSupportContact UsAPI Status
screen shot for web logo

No clutter. No distractions. Just clean, full-page screenshots with smart customization.

© 2026 HYDRANODE LTD. All rights reserved.

Screenshot for Web is operated by HYDRANODE LTD, a company registered in England and Wales, company number 15672526. Registered office: 124 City Road, London, London, England, EC1V 2NX.

FacebookInstagramLinkedInYouTube
  1. Home
  2. Blog
  3. Guides

Website screenshots in client reports: a PDF report built with Puppeteer, measured

We built an A4 screenshot report with Puppeteer and measured it: which image format keeps the PDF small, and how to stop tall captures leaving blank pages.

Screenshot for Web·November 4, 2026·7 min read

Sources

  1. Puppeteer: PDFOptions interface
  2. Puppeteer: ScreenshotOptions interface
  3. W3C: CSS Fragmentation Module Level 3 (monolithic content)
  4. MDN: break-inside
  5. Skia source: SkPDFBitmap.cpp, how images are written into PDFs
  6. Skia: the graphics engine for Google Chrome

How this article was made

Researched and drafted with AI assistance from the sources listed. On 4 November 2026 we captured four pages of our own site, screenshotforweb.com, and built every PDF in this article with Puppeteer 25.16.0 (Chrome for Testing 156.0.8078.47) on Node 22.21.1 on macOS. Sizes and image encodings were read with poppler's pdfinfo and pdfimages, and the page images were rendered with pdftoppm. Our free screenshot tool timed out that morning (HTTP 504 after 300 seconds), so the captures were made with Puppeteer directly.

Capture any page without ads, banners or chat widgets, free and without an account.

Try the free tools

More articles

  • News

    Puppeteer 25.19 stops print and dark mode emulation from cancelling each other

    Before Puppeteer 25.19.0, emulateMediaType and emulateMediaFeatures reset each other, losing print or dark mode. Our tests, the fix and a workaround.

    November 26, 2026
  • News

    Chrome 158 drops XSLT: what it does to screenshots of sitemaps and feeds

    We captured eight live sitemaps in Chrome 156 and Chromium 158. Styled pages turn into raw XML, a red warning bar is already in captures, and two fixes work.

    November 9, 2026
  • Research

    Chrome DevTools' full-size screenshot: where it fails on long and lazy pages

    We ran DevTools' full-size screenshot on six long pages: it stops at 16,384 pixels and misses content that appears on scroll. Here's why, and the fixes that worked.

    November 8, 2026

A client report with website screenshots needs three things to work: each capture labelled with its address and the time it was taken, an image format that doesn't bloat the PDF, and a way to lay out tall full-page captures without blank pages or unreadable thumbnails. We built such a report with Puppeteer and measured it. The short version: save the screenshots as JPEG, because Chrome copies JPEG bytes straight into the PDF while it re-compresses PNG and WebP; and show tall captures through page-sized windows, because a plain <img> taller than the page jumps to the next page and leaves its heading alone on a blank one.

This guide gives the two scripts we ran, the numbers, and the layout problems we hit.

What we built

The "client" is our own site, so nothing here describes anyone else's business. The report covers four pages of screenshotforweb.com: the home page, /tools, /pricing and /blog. Each page gets two captures:

  • Desktop, full page, at a 1440-pixel-wide viewport. This shows everything a visitor can scroll to.
  • Mobile, first screen, at 390 × 844 CSS pixels and a device pixel ratio of 2. This shows what a phone user sees before scrolling, which is usually what a client asks about.

Each capture is printed with its address and its capture time in UTC. A report that says "the pricing page" without a date is hard to use a month later, when the page has changed.

Step 1: capture the pages

This script visits each page, scrolls once so lazy-loaded images load before the full-page capture, and saves each capture three ways from the same page state: PNG, and JPEG and WebP at quality 80. It writes what it did to captures.json. We saved three formats only to compare them; a real report needs only the JPEG.

// Capture each report page on desktop (full page) and mobile (first screen).
import { createRequire } from "node:module";
import { writeFileSync } from "node:fs";
const require = createRequire(import.meta.url);
const puppeteer = require("puppeteer");

const site = "https://screenshotforweb.com";
const pages = ["/", "/tools", "/pricing", "/blog"];
const devices = {
  desktop: { width: 1440, height: 900, deviceScaleFactor: 1, fullPage: true },
  mobile: { width: 390, height: 844, deviceScaleFactor: 2, isMobile: true, hasTouch: true, fullPage: false },
};

const browser = await puppeteer.launch();
const log = [];
for (const path of pages) {
  for (const [name, { fullPage, ...viewport }] of Object.entries(devices)) {
    const page = await browser.newPage();
    await page.setViewport(viewport);
    const started = Date.now();
    await page.goto(site + path, { waitUntil: "networkidle2" });
    // Scroll once so lazy images load before a full-page capture.
    if (fullPage) await page.evaluate(async () => {
      for (let y = 0; y < document.body.scrollHeight; y += 800) { window.scrollTo(0, y); await new Promise(r => setTimeout(r, 100)); }
      window.scrollTo(0, 0);
    });
    const file = `cap-${path === "/" ? "home" : path.slice(1)}-${name}`;
    // Same page state, three encodings: PNG, and JPEG and WebP at quality 80.
    await page.screenshot({ path: `${file}.png`, fullPage });
    await page.screenshot({ path: `${file}.jpg`, fullPage, type: "jpeg", quality: 80 });
    await page.screenshot({ path: `${file}.webp`, fullPage, type: "webp", quality: 80 });
    const { w, h } = await page.evaluate(() => ({ w: document.documentElement.scrollWidth, h: document.documentElement.scrollHeight }));
    log.push({ url: site + path, device: name, file, capturedAt: new Date().toISOString(), cssSize: `${w}x${h}`, ms: Date.now() - started });
    await page.close();
  }
}
console.log("Chrome", await browser.version());
await browser.close();
writeFileSync("captures.json", JSON.stringify(log, null, 2));
console.table(log.map(({ file, cssSize, ms }) => ({ file, cssSize, ms })));

Puppeteer's quality option applies only to JPEG and WebP; its documentation says it is "not applicable to png images". The cssSize column is the page's full scroll size, not the size of the mobile image, which only covers the first screen. This is what our run printed:

Chrome Chrome/156.0.8078.47
┌─────────┬───────────────────────┬─────────────┬──────┐
│ (index) │ file                  │ cssSize     │ ms   │
├─────────┼───────────────────────┼─────────────┼──────┤
│ 0       │ 'cap-home-desktop'    │ '1440x9643' │ 5000 │
│ 1       │ 'cap-home-mobile'     │ '390x17286' │ 1483 │
│ 2       │ 'cap-tools-desktop'   │ '1440x3228' │ 2209 │
│ 3       │ 'cap-tools-mobile'    │ '390x5065'  │ 1104 │
│ 4       │ 'cap-pricing-desktop' │ '1440x2272' │ 1791 │
│ 5       │ 'cap-pricing-mobile'  │ '390x4801'  │ 1085 │
│ 6       │ 'cap-blog-desktop'    │ '1440x4302' │ 2694 │
│ 7       │ 'cap-blog-mobile'     │ '390x10082' │ 1120 │
└─────────┴───────────────────────┴─────────────┴──────┘

The desktop home page is 9,643 pixels tall. That one capture decides most of the layout problems below.

Which image format keeps the PDF small

We put the same eight captures into the same A4 report three times, once per format, and printed each with page.pdf(). Then we asked pdfimages -list how each picture was stored inside the PDF.

FormatEight captures on diskPDF sizeHow the PDF stores themTime for page.pdf()
PNG4.15 MB4.05 MBRe-compressed pixels (Flate)1,385 ms
JPEG, quality 802.43 MB2.55 MBThe original JPEG bytes (DCT)230 ms
WebP, quality 801.32 MB6.31 MBRe-compressed pixels (Flate)1,514 ms

The times are from one run each on a laptop, so treat them as a rough guide; the sizes are exact.

The surprise is WebP. It was the smallest on disk and gave by far the largest PDF, 2.5 times the JPEG one. The PDF file of Chrome's output names its producer as Skia/PDF m156; Skia is the graphics engine Chrome uses, and its PDF code explains the numbers. When an image's original encoded bytes are a suitable JPEG, Skia writes those bytes into the PDF unchanged with the DCTDecode filter. Every other image is decoded to raw pixels and compressed again with FlateDecode, which is lossless. A lossy WebP's compression noise is then stored losslessly, which costs more than the clean PNG did.

We checked the JPEG case directly: the home page image extracted from the PDF with pdfimages -j was byte-for-byte identical to cap-home-desktop.jpg. So for a report, JPEG is both the smallest choice and the one that doesn't change the picture again. Keep PNG for screenshots that will be compared pixel by pixel, not for PDFs.

Tall screenshots: three layouts, measured

A 1440 × 9,643 capture printed 186 mm wide (A4 minus 12 mm margins on each side) is about 1.25 metres tall. We tried three ways to fit it in.

Shrink it to one page. Scaled to fit a 225 mm tall box, the whole home page is 33.6 mm wide, 18% of the column. The report drops from 21 pages to 9, but none of the text can be read. Use this only as a thumbnail next to something readable.

Two report pages side by side. On the left, the whole home page screenshot shrunk into a narrow strip in the middle of one A4 page, too small to read. On the right, the same screenshot printed at full column width, where headings and buttons are legible.

Let it flow across pages. A plain <img> at full width is readable, and Chrome splits it between pages. To check whether rows go missing at the cuts, we printed a test image with a line and a label every 50 pixels. Nothing was lost or repeated: page 1 ended just after the line at pixel 2050 and page 2 began with the label for 2050. But the cut falls wherever the page ends, here through the middle of the label "4100".

Four strips cut from a PDF of a numbered test image. The bottom of page 1 ends at the 2050 line and the top of page 2 starts with the 2050 label. The bottom of page 2 shows the top half of the 4100 label and the top of page 3 shows its bottom half.

The bigger problem showed up on page 1. With a heading and a caption above the screenshot, Chrome printed the heading alone and moved the whole image to page 2, leaving most of page 1 blank. We tried break-after: avoid on the heading, display: inline on the image and a flex wrapper; all three gave the same blank page.

Three A4 pages. The first holds only the heading 'Home page, desktop' and the address line, with the rest of the page empty. The second starts with the home page screenshot. The third shows the fixed layout, with the heading, the address line and the screenshot together on one page.

The CSS Fragmentation specification explains why. It treats images as monolithic, meaning they contain no break points of their own. A browser first tries to break before a monolithic box, which here means after the heading. Only when a box doesn't fit even at the top of a fresh page may the browser "fragment the contents of monolithic elements by slicing". The specification also treats avoid values, which MDN's break-inside page lists for page, column and region breaks, as preferences that are dropped when there aren't enough break points. That matches what we saw: no CSS rule kept the heading with an image too tall for the page.

Show it through page-sized windows. The fix that worked is to never give Chrome an image taller than the space left on the page. We show the same image through a column of boxes with overflow: hidden, each as tall as a page (the first one shorter, to leave room for the heading), and shift the image up inside each box. That gave 5 pages for the home page instead of 6, with the heading and the screenshot together on page 1. The PDF still stores the image once: the five-page test PDF was 1.0 MB for a 0.96 MB JPEG.

Step 2: build the report

This is the report script we ran. It reads captures.json, shows desktop captures through windows, prints phones at 70 mm wide, and adds a footer with the report title and page numbers.

// Turn captures.json and its JPEG screenshots into an A4 report.
import { createRequire } from "node:module";
import { readFileSync } from "node:fs";
const puppeteer = createRequire(import.meta.url)("puppeteer");

const CONTENT_MM = { width: 186, height: 267 }; // A4 minus 12 mm side, 12 mm top and 18 mm bottom margins
const HEADING_MM = 20; // room taken by the heading and caption on a section's first page

// Show a tall screenshot through page-sized windows, so it never leaves its heading alone on a page.
function windows(src, widthPx, heightPx) {
  const pxPerMm = widthPx / CONTENT_MM.width;
  const tiles = [];
  for (let top = 0, first = true; top < heightPx; first = false) {
    const tall = Math.min(Math.floor((CONTENT_MM.height - (first ? HEADING_MM : 2)) * pxPerMm), heightPx - top);
    // A negative margin-top in % is a share of the width, so this moves the image up by `top` pixels.
    tiles.push(`<div class="window" style="aspect-ratio: ${widthPx} / ${tall}">
      <img src="${src}" style="margin-top: -${(top / widthPx) * 100}%"></div>`);
    top += tall;
  }
  return tiles.join("");
}

const captures = JSON.parse(readFileSync("captures.json", "utf8"));
const stamp = (iso) => iso.replace("T", " ").slice(0, 16) + " UTC";

const sections = captures.map((c) => {
  const src = `data:image/jpeg;base64,${readFileSync(`${c.file}.jpg`).toString("base64")}`;
  const [width, height] = c.cssSize.split("x").map(Number);
  const shot = c.device === "desktop" ? windows(src, width, height) : `<img class="phone" src="${src}">`;
  return `<section>
    <h2>${new URL(c.url).pathname} · ${c.device}</h2>
    <p class="meta">${c.url} · captured ${stamp(c.capturedAt)}</p>
    ${shot}
  </section>`;
}).join("");

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setContent(`<!doctype html><html><head><meta charset="utf-8">
<title>screenshotforweb.com: website screenshots</title><style>
  body { font: 11pt/1.4 system-ui, sans-serif; margin: 0; }
  section { break-before: page; }
  h2 { font-size: 14pt; margin: 0; }
  .meta { color: #555; font-size: 8.5pt; margin: 0 0 3mm; }
  .window { overflow: hidden; }
  .window img { display: block; width: 100%; }
  .phone { width: 70mm; border: 1px solid #ccc; }
</style></head><body>${sections}</body></html>`);
await page.pdf({
  path: "report.pdf",
  format: "A4",
  margin: { top: "12mm", bottom: "18mm", left: "12mm", right: "12mm" },
  displayHeaderFooter: true,
  headerTemplate: "<span></span>",
  footerTemplate: `<div style="font-size:8px; width:100%; padding:0 12mm; display:flex; justify-content:space-between">
    <span class="title"></span><span>Page <span class="pageNumber"></span> of <span class="totalPages"></span></span></div>`,
});
await browser.close();

It produced a 16-page, 2.51 MB PDF in which every page carries part of a screenshot and all 16 images are stored as JPEG. The same report with plain <img> tags was 18 pages, and four of them, one for each desktop capture, held nothing but a heading and an address.

A few details in it come straight from Puppeteer's PDFOptions documentation:

  • format defaults to letter, so set A4 if your clients are outside North America.
  • displayHeaderFooter defaults to false. The header and footer templates fill in elements with the classes date, title, url, pageNumber and totalPages. We passed an empty header so that only the footer prints.
  • printBackground defaults to false. Screenshots are images, not backgrounds, so they print either way, but any coloured boxes in your own report design need it set to true.
  • waitForFonts defaults to true, so the PDF waits for web fonts before printing.

What we'd put in every report

  1. The address and capture time on every screenshot, in UTC, written by the script rather than typed by hand.
  2. The viewport for each capture: "desktop, 1440 px wide, full page" or "mobile, first screen". A screenshot without its viewport invites the wrong comparison next month.
  3. JPEG at about quality 80 for anything going into a PDF. In our test it gave the smallest file and the PDF kept its bytes unchanged.
  4. Page-sized windows for tall captures, or a crop to the part of the page the report is about. Never a whole long page shrunk onto one sheet.
  5. The same pages, devices and settings every month, so this month's report can sit next to last month's.

If you'd rather not run Chrome yourself, our free screenshot tool captures desktop, laptop, tablet and mobile views as PNG, JPEG or WebP, and the API docs cover doing the same from a script.