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

Chrome’s documented --headless --print-to-pdf command creates a PDF, but its command-line reference does not document switches for setting paper width or height. To control page size, use Puppeteer’s page.pdf() options or Chrome DevTools Protocol’s Page.printToPDF method. If the document’s print CSS should determine page geometry, declare it with @page and enable preferCSSPageSize.

Choose where to set the page size

Use the setting that matches who should control the PDF’s geometry:

Approach Set the size in Best fit
CSS-owned Print stylesheet’s @page rule The document defines its intended paper size and margins.
Caller-owned Puppeteer PDF options or CDP parameters The rendering request chooses dimensions, including dynamically for different requests.

With either API, preferCSSPageSize defaults to false. When false, content is scaled to fit the PDF paper size; set it to true when CSS @page dimensions should take priority over API-supplied dimensions. These controls are documented in the Puppeteer PDFOptions reference and the DevTools Protocol Page reference.

Set paper size with Puppeteer

Pass width and height to page.pdf(). Puppeteer accepts numbers or strings with units; strings such as 210mm make the intended units explicit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Amazon Basics Multipurpose Copy Printer Paper, 8.5 x 11 Inches, 20 lb, 92 Bright, White, 1 Ream (500 Sheets), Jam-Free
  • 1 ream (500 sheets) of 8.5 x 11 white copier and printer paper for home or office use
  • Multipurpose letter size copy paper works with laser/inkjet printers, copiers and fax machines
  • Smooth 20lb weight paper for consistent ink and toner distribution; dries quickly and resists paper jams
  • Bright white paper (92 GE; 104 Euro) offers great contrast for crisp printing and vivid color
  • Virgin copy paper providing professional quality results; acid-free to prevent yellowing
await page.pdf({
  path: 'output.pdf',
  width: '210mm',
  height: '297mm',
  preferCSSPageSize: false,
});

This example selects A4 portrait dimensions directly and lets the options, rather than CSS, set the page size. If your CSS should be authoritative, define its size in an @page rule and change preferCSSPageSize to true. When setting dimensions directly, do not enable that preference unless CSS is intentionally meant to override them.

Use a named format instead

Puppeteer also provides the format option for supported standard paper formats. Use either a named format or explicit dimensions when selecting the page geometry; avoid relying on conflicting size settings. Consult the PDFOptions reference for the current supported options and units.

Rank #2
HP Printer Paper | 8.5 x 11 Paper | Copy &Print 20 lb | 1 Ream Case - 500 Sheets| 92 Bright | FSC Certified | 200060
  • HP Papers is sourced from renewable forest resources and has achieved production with 0% deforestation in North America. Each ream is wrapped in a polyurethane coated paper wrapper to protect the cut sheets from moisture damage
  • Sheet size – 8.5 x 11; Thickness – 20 pounds; Brightness – 92 bright white
  • HP Copy&Print20 20 pounds printer paper is Forest Stewardship Council (FSC) certified and contributes toward satisfying credit MR1 under LEED (Leadership in Energy and Environmental Design)
  • All HP Papers provide premium performance on HP equipment, as well as on all other printer and copier equipment; 100% satisfaction guaranteed; ColorLok technology provides more vivid colors, bolder blacks and faster drying
  • Superior quality, reliability, and dependability for high-volume printing at home, at school and in the office; HP Copy&Print20 print and copy paper prevents yellowing over time to ensure a long-lasting appearance for added archival quality

Set paper size through Chrome DevTools Protocol

Call Page.printToPDF with paperWidth and paperHeight, measured in inches. For example, the following values specify approximately A4 dimensions; they are an example, not a universal default:

const result = await client.send('Page.printToPDF', {
  paperWidth: 8.27,
  paperHeight: 11.69,
  preferCSSPageSize: false,
});

The protocol documents defaults of 8.5 inches wide by 11 inches high. Set both dimensions explicitly when your output must use a particular size rather than those defaults. Set preferCSSPageSize: true if CSS @page sizing should take precedence. See the Page domain reference for the current protocol parameters; the protocol’s Page definition also describes print-to-PDF behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Hammermill Printer Paper, Premium Inkjet & Laser Paper 24 Lb, 8.5 x 11-1 Ream (500 Sheets) - 97 Bright, Made in the USA, 166140R
  • PREMIUM PRINTER PAPER – Hammermill Premium Inkjet & Laser 24lb Printer Paper is a versatile sheet that’s perfect for double-sided inkjet or laser printed projects. With a 97 brightness & blue-white shade, you get consistently sharp, clear images.
  • COLORLOK TECHNOLOGY – This computer paper features ColorLok Technology for colors that are 30% brighter, blacks that are 60% bolder and ink that dries 3x faster. This white copy paper will provide consistently superior results.
  • PERFECT FOR PRINTING – This multi-purpose copier paper is designed to run smoothly through all office equipment for professional results when printing newsletters, flyers, reports, memos, and more. It’s also acid-free paper to prevent yellowing over time.
  • SUSTAINABLY MADE IN THE USA – Original Hammermill printer paper is Forest Stewardship Council (FSC) certified, which means they are made with renewable resources from third-party certified, sustainably managed forests.

Let print CSS control the page

Declare page dimensions and margins in the document when they are part of the document’s print layout:

@page {
  size: A4 portrait;
  margin: 12mm;
}

Then generate the PDF with preferCSSPageSize: true in Puppeteer or the corresponding parameter in CDP. Without that preference, the documented default is to scale content to fit the dimensions selected by PDF options or their defaults, rather than give the CSS page size priority.

Rank #4
HP Papers | 8.5 x 11 Paper | All In One 22 lb | 1 Mega Ream - 750 Sheets | 96 Bright | Made in USA - FSC Certified | 207750R
  • MADE IN USA - HP Papers is sourced from renewable forest resources and has achieved production with 0% deforestation in North America. See images.
  • OPTIMIZED FOR HP TECHNOLOGY - All HP Papers provide premium performance on HP equipment, as well as on all other printer and copier equipment. 100% satisfaction . See images.
  • PERFECT OFFICE PAPER WHEN YOU NEED TO PRINT COLOR DOCUMENTS - HP All-In-One22 is thicker, brighter and whiter than ordinary multipurpose printing papers and is optimized for all inkjet and laser printers and copiers.
  • CERTIFIED SUSTAINABLE - HP All-In-One22 22lb printer paper is Forest Stewardship Council (FSC) certified and contributes toward satisfying credit MR1 under LEED (Leadership in Energy and Environmental Design). See images.
  • COLORLOK TECHNOLOGY PRINTING PAPER - Colorlok technology provides more vivid colors, bolder blacks and faster drying. See images.

Keep paper size separate from screen and print styling

Puppeteer’s page.pdf() uses the print CSS media type. This determines which media-query styles are applied; it is separate from the PDF’s paper dimensions. To render using screen styles instead, select screen media before generating the PDF:

await page.emulateMediaType('screen');
await page.pdf({
  path: 'output.pdf',
  width: '210mm',
  height: '297mm',
});

Changing media type does not itself choose a paper size. The Puppeteer Page.pdf() documentation describes its print-media behavior and screen-media alternative.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Amazon Basics Multipurpose Copy Printer Paper, 20 lb, 8.5 x 11 Inches, 3 Reams (1,500 Sheets), 92 Bright White for Home Use
  • 3 ream case (1,500 sheets) of 8.5 x 11 white copier and printer paper for home or office use
  • Multipurpose letter size copy paper works with laser/inkjet printers, copiers and fax machines
  • Smooth 20lb weight paper for consistent ink and toner distribution; dries quickly and resists paper jams
  • Bright white paper (92 GE; 104 Euro) offers great contrast for crisp printing and vivid color
  • Virgin copy paper providing professional quality results; acid-free to prevent yellowing
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why the command-line flag does not set custom dimensions

Chrome’s documented headless CLI flow uses --headless --print-to-pdf to save a PDF. The current Headless CLI reference does not document paper-width or paper-height switches, so use Puppeteer or CDP when you need programmatic dimensions.

The CLI reference also documents --timeout for controlling the maximum wait before capture and --no-pdf-header-footer for disabling PDF header and footer content. It notes that the latter replaced the older --print-to-pdf-no-header flag; older Chrome versions may require the prior name. These options affect capture timing or headers, not paper dimensions.

Troubleshoot unexpected PDF dimensions

  • CSS page size appears ignored: Enable preferCSSPageSize: true in Puppeteer or CDP. With its default value of false, CSS page dimensions do not take priority over the PDF options or defaults.
  • Content is scaled or does not fit as expected: Check whether the API-selected dimensions are the intended size and whether CSS should be authoritative. With preferCSSPageSize: false, content is scaled to fit the selected paper.
  • The PDF uses Letter-like dimensions instead of the requested size: Set both width and height explicitly using Puppeteer or CDP. CDP’s documented defaults are 8.5 by 11 inches.
  • The layout differs from the browser window: Puppeteer PDFs use print media by default. Review print styles, or call page.emulateMediaType('screen') before PDF generation if screen styles are intended.
  • The command-line run produces a PDF but not the requested paper size: The documented CLI flags cover PDF output, timeout and headers, not paper dimensions. Move the size configuration to Puppeteer or CDP.

Or skip the browser setup

For a screenshot or PDF from a URL without configuring browser automation, ScreenshotNeo accepts a single GET request. Its PDF options include paper size, margins, landscape and page ranges. It also removes cookie/consent banners, newsletter popups and chat widgets before capture; bot checks, blank pages and failed loads are not billed; and an 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 shots.

For example, request the PDF format and paper size using the ScreenshotNeo API documentation:

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://stripe.com 
  -d format=pdf 
  -d paper_size=A4 
  -o page.pdf

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Quick Recap

Bestseller No. 1
Amazon Basics Multipurpose Copy Printer Paper, 8.5 x 11 Inches, 20 lb, 92 Bright, White, 1 Ream (500 Sheets), Jam-Free
Amazon Basics Multipurpose Copy Printer Paper, 8.5 x 11 Inches, 20 lb, 92 Bright, White, 1 Ream (500 Sheets), Jam-Free
1 ream (500 sheets) of 8.5 x 11 white copier and printer paper for home or office use; Virgin copy paper providing professional quality results; acid-free to prevent yellowing
$6.97
Bestseller No. 2
HP Printer Paper | 8.5 x 11 Paper | Copy &Print 20 lb | 1 Ream Case - 500 Sheets| 92 Bright | FSC Certified | 200060
HP Printer Paper | 8.5 x 11 Paper | Copy &Print 20 lb | 1 Ream Case - 500 Sheets| 92 Bright | FSC Certified | 200060
Sheet size – 8.5 x 11; Thickness – 20 pounds; Brightness – 92 bright white
$6.97
Bestseller No. 5
Amazon Basics Multipurpose Copy Printer Paper, 20 lb, 8.5 x 11 Inches, 3 Reams (1,500 Sheets), 92 Bright White for Home Use
Amazon Basics Multipurpose Copy Printer Paper, 20 lb, 8.5 x 11 Inches, 3 Reams (1,500 Sheets), 92 Bright White for Home Use
Virgin copy paper providing professional quality results; acid-free to prevent yellowing
$21.96

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.