October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Change Paper Size in Headless Chrome print-to-PDF

Set PDF paper dimensions in headless Chrome with Puppeteer or the DevTools Protocol, and learn when CSS @page rules take priority.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Chrome’s documented --headless --print-to-pdf command saves a PDF, but its current command-line reference does not document paper-width or paper-height switches. To control the page size, generate the PDF with Puppeteer’s page.pdf() or the Chrome DevTools Protocol’s Page.printToPDF. Use CSS @page rules when the document should own its page geometry, and enable preferCSSPageSize so the browser honors them.

Set a paper size with Puppeteer

Pass dimensions to page.pdf(). Puppeteer accepts numbers or strings with units for width and height. This example selects A4 portrait dimensions directly:

As an Amazon Associate I earn from qualifying purchases.

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

When you supply dimensions directly and want them to determine the output, leave preferCSSPageSize unset or set it to false. If it is true, a CSS @page size takes priority over width, height, or format. See the Puppeteer PDFOptions reference.

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

Use a named paper format

For a named format supported by Puppeteer, use format rather than specifying both dimensions:

#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',
  format: 'A4',
});

Choose either a named format or explicit dimensions according to your application. If you need a custom size or choose dimensions dynamically per request, set width and height.

Set paper dimensions through the Chrome DevTools Protocol

With CDP, call Page.printToPDF and pass paperWidth and paperHeight in inches. The protocol documents defaults of 8.5 inches wide by 11 inches high. For example, these values are approximately A4 dimensions:

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
{
  "paperWidth": 8.27,
  "paperHeight": 11.69,
  "preferCSSPageSize": false
}

The numbers are inches, not millimeters. Replace them with the dimensions your application requires. The CDP Page domain reference documents the method, defaults, and CSS-size preference.

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

Let print CSS control the page size

Use an @page rule when page geometry belongs with the document’s print styles—for example, when the same stylesheet defines the layout and paper size:

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.
@page {
  size: A4 portrait;
  margin: 12mm;
}

Then give CSS page sizing priority in Puppeteer:

await page.pdf({
  path: 'output.pdf',
  preferCSSPageSize: true,
});

For CDP, set preferCSSPageSize: true in the Page.printToPDF parameters as well. With the documented default of false, content is scaled to fit the paper size selected by the PDF options (or their defaults); CSS page size does not take priority. See the Puppeteer options and the CDP protocol reference.

Choose who owns the dimensions

  • CSS-owned: Declare @page { size: ... } and enable preferCSSPageSize. This suits documents whose print stylesheet should define page geometry.
  • Caller-owned: Supply dimensions in Puppeteer or CDP. This suits a rendering service that selects page dimensions for each request.

Do not enable CSS priority accidentally: when it is true, CSS can override dimensions you passed to the PDF API.

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.

Understand print media and page layout

Puppeteer’s page.pdf() uses the print CSS media type. If the output should use screen styles instead, call page.emulateMediaType('screen') before generating the PDF:

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.
await page.emulateMediaType('screen');
await page.pdf({ path: 'output.pdf', width: '210mm', height: '297mm' });

Media selection controls which CSS rules lay out the page; it is separate from choosing paper dimensions. For print-specific layout, keep the default print media and define print rules such as @page. See Puppeteer’s Page.pdf() documentation.

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

What the headless Chrome command line can set

The documented CLI pattern is --headless --print-to-pdf. The current Chrome Headless command-line reference also documents --timeout, which controls the maximum wait before printing, and --no-pdf-header-footer to suppress PDF headers and footers. It notes that older Chrome versions may use the prior --print-to-pdf-no-header flag. The reference does not document CLI switches for paper width or height, so use Puppeteer or CDP when dimensions must be set programmatically.

Troubleshoot unexpected PDF dimensions

  • The PDF ignores the supplied width or height: Check whether preferCSSPageSize is true. If CSS should not override API dimensions, remove it or set it to false; if CSS should win, check the document’s @page rule.
  • The CDP output is the wrong size: Confirm that paperWidth and paperHeight are in inches, not millimeters.
  • Content looks scaled or does not fit as expected: With CSS priority off, the protocol scales content to fit the selected paper dimensions. Review the selected dimensions and whether CSS page sizing should instead take priority.
  • The PDF uses the wrong styling: Puppeteer prints with the print media type by default. If you specifically need screen rules, call page.emulateMediaType('screen') before page.pdf().
  • A CLI flag for paper size has no effect: Paper-dimension switches are not documented in the current CLI reference. Set the size through Puppeteer or CDP instead.

These references track current Chrome, CDP, and Puppeteer documentation and may change. Check the documentation for the versions deployed in your environment before relying on version-sensitive behavior.

Or skip the browser setup

If you need a PDF from a URL rather than a custom Puppeteer or CDP workflow, ScreenshotNeo provides a screenshot and PDF API. One GET request can return a PDF; the API also supports paper size, margins, landscape orientation, and page ranges. It does not replace a workflow that requires your own browser automation code.

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

cURL example, adapted to request a PDF for the target URL:

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
curl -G "https://api.screenshotneo.com/v1/shot" 
  -d access_key=YOUR_API_KEY 
  --data-urlencode url=https://stripe.com 
  -d format=pdf 
  -o document.pdf

See the ScreenshotNeo API documentation for request parameters. ScreenshotNeo removes supported cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. Its MCP server lets AI agents take screenshots. The Free plan includes 1,000 shots per month with no card, and paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo’s free plan.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.