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

Puppeteer PDFs change size or layout when the PDF options and the page’s print CSS disagree, when print rules differ from screen rules, or when content is not ready before capture. Make one source of truth responsible for paper size, set orientation, margins, and scale explicitly, and wait for fonts and page content before calling page.pdf().

Why Puppeteer PDF dimensions change

page.pdf() generates a PDF using the print CSS media type. It does not simply take a screenshot of the current browser viewport. Print-specific styles can hide elements, change widths, and alter page breaks. The PDF’s paper box and the content laid out inside that box are also affected by different controls, so a page can have the expected paper size while its content appears smaller, larger, or rearranged.

The API and CSS both set page size

Puppeteer’s PDF options accept a named format or explicit width and height. The page can also declare a size in CSS with @page. By default, preferCSSPageSize is false: CSS page dimensions are scaled to fit the size selected by the API. Set it to true when the CSS @page size should take priority over format, width, or height.

An implicit paper size is still a choice

If you omit format, Puppeteer’s documented default is Letter. Letter is 8.5 × 11 inches; A4 is 21 × 29.7 cm. A document styled for A4 can therefore be fitted to Letter unless you explicitly make CSS page size authoritative or configure the API to use A4. Orientation and margins affect the usable content area even when the paper dimensions are correct.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Brother DCP-L2640DW Wireless Compact Monochrome Multi-Function Printer, Copy, Scan, Duplex, Mobile Printing
  • BEST FOR SMALL BUSINESSES – Engineered for extraordinary productivity, the Brother DCP-L2640DW Monochrome (Black & White) 3-in-1 combines laser printer, scanner, copier in one compact footprint and delivers high-quality black & white prints
  • FAST PRINTER WITH EFFICIENT SCANNING – Produces documents quickly with print speeds up to 36 ppm(2) and scan speeds up to 23.6/7.9 ipm(3) (black/color). A 50-page auto document feeder(4) allows for convenient, time saving multi-page scanning and copying
  • FLEXIBLE CONNECTION OPTIONS – Easily navigate the changing demands of your business with secure multi-device connectivity via built-in dual-band wireless (2.4GHz / 5GHz) and Ethernet. Or connect locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Print, scan, and manage your wireless printer anytime, from almost anywhere from your mobile device. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(5)
  • CHOOSE BROTHER GENUINE TONER – When it’s time to replace your toner, be sure to choose Brother Genuine TN830 or TN830XL replacement toner. And with Refresh EZ Print Subscription Service, you’ll never worry about running out of toner again and you’ll enjoy savings of up to 50%(6) on Brother Genuine Toner. Get started with Refresh today with a Free Trial(1)

Print CSS reflows the page

Because PDF generation uses print media, rules inside @media print apply. These may set different widths and margins, hide screen-only controls, or change pagination. If your intention is to render the page with screen CSS, call page.emulateMediaType('screen') before generating the PDF. That changes which media rules apply; it does not by itself resolve a conflict between CSS page size and the PDF options.

Scale changes content, not the paper box

The PDF option scale accepts values from 0.1 to 2 and defaults to 1. Changing it changes the rendered content’s geometry, even if paper dimensions remain unchanged. If the paper is correct but text and layout look uniformly too small or large, check scale as well as the page-size settings.

Viewport-dependent layout and readiness can change pagination

Responsive rules and relative or viewport-based units can reflow when content is laid out for print. Viewport-related units in @page are also an area of ongoing standards discussion. Dynamic application data, images, and fonts can affect line wrapping and page breaks if they arrive late. Puppeteer’s PDF options include waitForFonts, which defaults to true, but that does not replace waiting for your application’s data or images to be ready.

Rank #2
Brother HL-L2405W Wireless Compact Monochrome Laser Printer with Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOMES & HOME OFFICES – Engineered for consistent, premium print quality, the Brother HL-L2405W Monochrome (Black & White) Laser Printer delivers sharp, crisp prints at an affordable price. Prints one-sided documents at speeds up to 30ppm(2)
  • COMPACT, CONNECTED PRINTER – Flexible connection options make this an ideal printer for home use and at-home offices. Securely connect to multiple devices with built-in dual-band wireless (2.4GHz/5GHz) or locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Manage your printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Enjoy seamless, reliable everyday printing with the 250-sheet paper tray(4) and a manual feed slot that enables printing on envelopes and specialty pape
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer

Choose one source of truth for page geometry

Approach Set in Puppeteer Set in CSS Use when
CSS owns page size Set preferCSSPageSize: true; avoid conflicting API dimensions. Declare the intended size and margins in @page. The document’s print stylesheet should define its paper geometry.
Puppeteer owns page size Set format or explicit width and height; leave preferCSSPageSize false. Omit conflicting @page size declarations. Your application or job configuration should select paper size.

Do not leave orientation, margins, scale, or background rendering to assumptions. Define them explicitly, then verify that the page’s print CSS follows the same geometry model.

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

Use explicit settings for a predictable A4 PDF

This example uses CSS as the page-size authority. It sets A4 portrait dimensions and 12 mm margins in both the CSS page rule and Puppeteer’s margin options, waits for network activity to settle, waits for fonts, and prints backgrounds. The values are an implementation pattern, not a guarantee that every application’s content will paginate identically.

await page.setContent(html, {waitUntil: 'networkidle0'});
await page.evaluate(() => document.fonts.ready);
await page.pdf({
  path: 'output.pdf',
  width: '210mm',
  height: '297mm',
  margin: {top: '12mm', right: '12mm', bottom: '12mm', left: '12mm'},
  preferCSSPageSize: true,
  printBackground: true,
  scale: 1,
  landscape: false,
});
@page {
  size: 210mm 297mm;
  margin: 12mm;
}

@media print {
  html, body { margin: 0; }
  .screen-only { display: none !important; }
}

If your application navigates to an existing page rather than using setContent(), wait for the navigation and for the page’s own data-loading condition before printing. networkidle0 is useful for the supplied HTML-loading example, but an application with continuing network requests may need an application-specific readiness signal instead. Likewise, wait for images or other asynchronous content if they affect the document’s layout.

Rank #3
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only
  • FAST PRINT SPEEDS: Print up to 19 pages per minute.
  • COMPACT DESIGN: Space-saving, compact design fits anywhere in your home, school or small office.
  • WIRELESS CONNECTIVITY: Print from almost anywhere in your workspace using your compatible mobile device.
  • PAPER CAPACITY: Up to 150 sheets.
  • SUSTAINABILITY: Uses less than 2 watts in Energy Saver mode.

Match the symptom to the setting

Symptom Likely cause What to check
A4 content appears on Letter-sized pages The API-selected paper takes priority and CSS page size is being fitted to it. Set preferCSSPageSize: true if CSS should own size, or select A4 in the API and remove conflicting CSS size declarations.
The paper dimensions look right but content is too small or large Scale or available content area differs. Set scale: 1 explicitly and inspect margins, orientation, and print widths.
The PDF looks different from the browser PDF generation uses print media, not screen media. Inspect @media print; use page.emulateMediaType('screen') only if screen styling is actually intended.
Page breaks vary between runs Data, fonts, or images may not be ready at print time. Wait for application data and assets, and ensure fonts are ready before calling page.pdf().
Local output differs from CI output The same CSS and PDF controls may be receiving different content or readiness timing. Log the effective PDF options, use a single page-size authority, and wait for the same data and assets in both environments.

Troubleshoot Puppeteer PDF size and layout

Check the paper format first

Make format explicit if the API owns geometry. If you intend Letter but omit format, the documented default is Letter; if you intend A4, do not rely on the default. When CSS owns size, set preferCSSPageSize: true and ensure the @page rule declares the desired dimensions.

Remove conflicting dimensions

A PDF job that declares A4 in CSS but specifies Letter or different explicit dimensions in Puppeteer has two competing size authorities. Decide which one wins. For CSS-owned geometry, use @page and enable CSS priority. For API-owned geometry, set the API dimensions and remove a conflicting @page size.

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

Separate page size from margins

Paper size describes the page; margins define the space available to content. A wide margin can make a correctly sized sheet look as though its content has been scaled down. Set all four margins deliberately, and avoid relying on unrelated browser or stylesheet margins to determine the print content area.

Rank #4
Brother HL-L2460DW Wireless Compact Monochrome Laser Printer with Duplex, Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOME OFFICES & SMALL TEAMS – Engineered for consistent, premium print quality, the Brother HL-L2460DW Monochrome (Black & White) Laser Printer produces documents that are clear, crisp, and easy to review and share, all at an affordable price
  • COMPACT, CONNECTED, EXCEPTIONALLY EFFICIENT– Connect with built-in dual-band wireless (2.4GHz/5GHz), Ethernet, or to a single computer via USB interface. Prints at speeds up to 36ppm(2), plus automatic duplex printing saves time and reduces paper waste
  • BROTHER MOBILE CONNECT APP – Manage your wireless printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Tackle high-volume black & white printing with the 250-sheet capacity paper tray.(4) The manual feed slot enables printing on envelopes and specialty paper
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer

Inspect print-only rules and orientation

Compare the page’s normal layout with its @media print rules. Check whether print CSS changes widths, hides elements, or introduces break rules. Set landscape explicitly: a landscape choice changes the page orientation and the available width, which can change wrapping and pagination.

Confirm scale and background behavior

Use scale: 1 when you want the default content scale made explicit. Set printBackground: true if colored backgrounds or other background graphics are part of the intended output; otherwise, a PDF may look different even when its dimensions are correct.

Wait for the page you mean to print

Waiting for navigation alone may not mean that application data, images, or custom fonts have finished changing the layout. Wait for an application-specific ready state where appropriate, and let fonts resolve before capture. Puppeteer’s waitForFonts PDF option defaults to true; the example also awaits document.fonts.ready explicitly. Neither step can make missing application data appear, so handle data and image readiness separately.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
HP LaserJet M110w | Monochrome | Laser Printer
  • FROM AMERICA'S MOST TRUSTED PRINTER BRAND – Perfect for small teams printing professional-quality black & white documents and reports. Perfect for 1-3 people
  • WORLD'S SMALLEST LASER IN ITS CLASS – Precision laser printing that fits anywhere
  • FAST PRINT SPEEDS – Up to 21 black-and-white pages per minute single-sided
  • WIRELESS WITH SELF-RESET – Helps you stay connected
  • PRINT FROM ANY DEVICE – Wireless printing from any mobile device, PC or tablet. Works with Microsoft, Mac, AirPrint, Android, Chromebook and more
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need a screenshot or PDF without maintaining a Puppeteer rendering setup, ScreenshotNeo is a website screenshot API and MCP server for developers. It returns PNG, JPEG, or WebP screenshots or a PDF from a GET request. The API also supports PDF settings such as paper size, margins, landscape orientation, and page ranges. See the ScreenshotNeo API documentation for request parameters.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Before capture, it can accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. AI agents can use its MCP server tools, including take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Every feature is available on every plan. Sign up for ScreenshotNeo and start with 1,000 free screenshots a month, with no card required.

Keep CI and local PDFs consistent

  • Use the same chosen paper size and geometry authority in both environments.
  • Set margins, orientation, scale, and background behavior explicitly.
  • Use the same print stylesheet and wait for application data, fonts, and layout-affecting images.
  • When a difference appears, compare the effective PDF options and the rendered print layout before changing scale.

These controls make the inputs to PDF layout explicit. They do not eliminate differences caused by different page content or readiness timing, so those conditions should be made consistent as well.

Frequently Asked Questions

What is Puppeteer’s default PDF paper size?

The documented default format is Letter.

Does `preferCSSPageSize: true` change the page’s CSS media type?

No. `page.pdf()` still generates using print CSS; the option controls whether CSS `@page` size takes priority over API dimensions.

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.

Can I use `page.pdf()` to render screen styles?

Yes. Call `page.emulateMediaType(‘screen’)` before PDF generation if screen media styling is the intended result.

Quick Recap

Bestseller No. 3
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only
FAST PRINT SPEEDS: Print up to 19 pages per minute.; PAPER CAPACITY: Up to 150 sheets.; SUSTAINABILITY: Uses less than 2 watts in Energy Saver mode.
$140.00
Bestseller No. 5
HP LaserJet M110w | Monochrome | Laser Printer
HP LaserJet M110w | Monochrome | Laser Printer
WORLD'S SMALLEST LASER IN ITS CLASS – Precision laser printing that fits anywhere; FAST PRINT SPEEDS – Up to 21 black-and-white pages per minute single-sided

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.