Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Puppeteer gives you control over how a page is rendered into a PDF—paper dimensions, margins, scale, print backgrounds, and page selection—but its documented Page.pdf() options do not include a PDF compression or image-downsampling setting. To manage file size without guessing, fix the page and browser inputs, change one rendering option at a time, record the resulting bytes and page count, and inspect the output for visual or layout problems.

Separate rendering quality from file-size reduction

A PDF’s appearance is shaped by the page’s CSS and assets, the browser’s print rendering, and the options passed to page.pdf(). Puppeteer documents controls for those rendering decisions. The API references reviewed do not document a compression option, an image-downsampling option, or a guarantee that changing a rendering option will make the PDF smaller.

That distinction matters when setting expectations. Changing scale changes the rendered page scale; it is not documented as compression. Turning off backgrounds may remove visual content, not intelligently optimize it. Restricting pageRanges omits pages, but does not compress the pages that remain. Treat any byte-size change as something to measure for your particular page and browser version.

The documented behavior below was checked against Puppeteer’s rolling documentation on September 29, 2026; the option details were also corroborated against Puppeteer Core 24.42.0. Defaults may change, so check the documentation matching your installed Puppeteer version.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the media type and page geometry first

Print CSS is the default

page.pdf() generates the PDF using print CSS media by default. This is usually the right choice when the page has print-specific rules, such as simplified navigation, adjusted typography, or page-break styles. If you specifically want the screen stylesheet, call await page.emulateMediaType('screen') before creating the PDF. Do not switch media types merely to chase a smaller file: it is a choice about which styles should render.

Colors may be adjusted for printing. If the design depends on exact colors, Puppeteer’s guide identifies -webkit-print-color-adjust as a way to request exact colors. This affects rendering appearance; it is not a documented compression control. See the Page.pdf() API and PDF generation guide.

Make CSS and Puppeteer agree on paper size

Choose the intended paper geometry before adjusting scale. The format option defaults to Letter and takes precedence over width and height. When you need a custom size, set width and height rather than relying on an unrelated paper format. CSS can also define page geometry with @page: set preferCSSPageSize: true when that stylesheet size should take priority. Otherwise, content is scaled to fit the paper size.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Specify margins explicitly if the output needs them. The documented default is no margins. A CSS page size, API paper setting, and margin combination that disagree can affect pagination and scaling, so verify the physical layout before testing other variables.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the PDF options for their documented purpose

Option Documented behavior How to use it
format Defaults to Letter and takes precedence over width and height. Set the expected paper standard, or omit it when custom dimensions should govern.
width, height Set paper dimensions. Use them for a custom paper size and keep them consistent with CSS @page.
preferCSSPageSize Defaults to false. When true, CSS @page size takes priority; otherwise content is scaled to fit the paper size. Set true when the stylesheet is the authority for page dimensions.
margin Defaults to no margins. Set explicit margins for predictable printable space and pagination.
scale Defaults to 1; accepted range is 0.1 to 2. Use it as a rendering-scale control. Recheck text size and page breaks after any change.
printBackground Defaults to false. Enable it only when background graphics are part of the intended design.
waitForFonts Defaults to true. Keep font waiting enabled when the intended typography matters.
pageRanges An empty string prints all pages. Select only needed pages when appropriate; this omits pages rather than compressing them.
tagged The API documents this as experimental and lists a default of true. Consider accessibility needs and validate the result. Do not change it for file size without evidence.

These behaviors are documented in Puppeteer PDFOptions. The tagged-PDF behavior is experimental, so validate it against your accessibility requirements rather than treating it as a size optimization.

Build a repeatable baseline before optimizing

  1. Fix the inputs. Use the same URL or HTML, assets, fonts, browser and Puppeteer versions, viewport where relevant, and wait conditions for each run. Make sure the page is in the intended media mode.
  2. Set the intended layout. Define the paper size, margins, CSS @page behavior, and print styles. Check that the resulting page breaks and image dimensions are correct.
  3. Generate a baseline PDF. Keep font waiting enabled unless you have deliberately chosen another approach. Record the output byte count and page count.
  4. Change one input. For example, compare background graphics on and off only if omitting them is visually acceptable, or test a different scale only if the resulting text remains readable.
  5. Inspect and record. Compare text readability, typography, images, colors, pagination, page count, and bytes. Keep the configuration that meets your visual and layout requirements—not simply the one with the lowest byte count.

This is a measurement workflow, not a promise that a particular option will shrink a PDF. The Puppeteer sources provide no compression ratios, expected file sizes, or quantified image-quality outcomes. If the bytes must be reduced, investigate and measure the page’s actual content and assets separately; do not describe a rendering option as a compressor unless the tool’s documentation establishes that behavior.

Runnable Puppeteer example

This Node.js example opens a page, waits for font readiness through the documented default, and writes a PDF. It uses print media, explicit margins, and CSS page sizing. Replace the URL and geometry with values that match your page. Install Puppeteer in the project before running it.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.goto('https://example.com', { waitUntil: 'networkidle0' });

    // page.pdf() uses print media by default.
    const pdf = await page.pdf({
      path: 'output.pdf',
      preferCSSPageSize: true,
      margin: {
        top: '12mm',
        right: '12mm',
        bottom: '12mm',
        left: '12mm'
      },
      scale: 1,
      printBackground: true,
      waitForFonts: true,
      pageRanges: ''
    });

    console.log(`Wrote ${pdf.length} bytes to output.pdf`);
  } finally {
    await browser.close();
  }
})();

For screen-styled output, explicitly switch media before generating the PDF:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.emulateMediaType('screen');
const pdf = await page.pdf({ path: 'screen-styled.pdf' });

Use that only when screen CSS is the desired design. If you want a standard paper size instead of CSS-controlled geometry, set format, for example format: 'A4', and ensure your styles and expected margins match. Since format takes priority over width and height, avoid setting conflicting geometry and assuming all three will apply.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot output that looks wrong or remains large

Colors or backgrounds are missing

printBackground defaults to false. Set it to true when the design requires background graphics, then inspect the result. For print color adjustments, consider the documented -webkit-print-color-adjust CSS behavior. Neither setting is a compression feature.

The PDF uses unexpected page dimensions or pagination

Check whether format is overriding width and height. If CSS @page should control sizing, set preferCSSPageSize: true. Confirm that margins are explicit where needed, then inspect page breaks before changing scale.

Text is too small or page breaks changed

Scale defaults to 1 and accepts values from 0.1 through 2. A lower scale changes rendering, not just file size. Re-check legibility, image dimensions, and pagination after changing it; return to the prior value if the layout no longer meets requirements.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fonts are missing or substituted

Puppeteer’s PDF guide says PDF generation waits for fonts by default. The waitForFonts default is true; keep it enabled when typography matters. If you deliberately disable waiting, ensure your application has another reliable way to confirm fonts are ready before capture.

The file is still large

Do not expect a guaranteed reduction from changing scale, backgrounds, tags, or paper settings: the reviewed API documentation does not establish that these options compress the output. Hold inputs constant, capture a baseline, change one factor, and measure bytes alongside page count and visual fidelity. If you only need some pages, pageRanges can select them, but it does not optimize the remaining pages.

Or skip the browser setup

If your task is to capture a clean website screenshot rather than tune a Puppeteer PDF’s print layout, ScreenshotNeo provides a screenshot API and MCP server. It is not a substitute for controlling Puppeteer’s paper geometry, CSS, or PDF rendering options.

One GET request can return an image capture; this example saves the response as WebP:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

See the ScreenshotNeo API documentation for the API details. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Sign up for free.

Sources

Frequently Asked Questions

Does Puppeteer offer a built-in PDF compression setting?

The reviewed Page.pdf() documentation does not document one.

Which Puppeteer version should I check option defaults against?

Use the documentation matching the Puppeteer version installed in your project; the API is version-sensitive.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.