The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Pass a margin object to page.pdf(), with separate values for top, right, bottom and left. Use strings with explicit units, such as '20mm', when you need predictable physical measurements. Puppeteer documents no margins as the default when margin is undefined.
Set the four PDF margins in Puppeteer
Choose the paper size and add the margin object to the same page.pdf() call:
As an Amazon Associate I earn from qualifying purchases.
await page.pdf({
format: 'A4',
margin: {
top: '20mm',
right: '15mm',
bottom: '20mm',
left: '15mm',
},
path: 'output.pdf',
});
This is an illustrative configuration. The margin object accepts optional edge values, each documented as a string or number. Explicit-unit strings make the intended physical size clear. The official type reference does not specify a unit-conversion table. Puppeteer PDFMargin interface
Free tools Windows power users keep installed
One-click scans. No signup required.
Use equal margins
For the same margin on every edge, provide the same value four times:
#1 Best Overall
- 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({
format: 'Letter',
margin: {
top: '0.5in',
right: '0.5in',
bottom: '0.5in',
left: '0.5in',
},
path: 'output.pdf',
});
The API shape uses named edges rather than a single shorthand value, so specify all four when you want uniform margins. Puppeteer PDFOptions interface
Leave margins unset
If you omit margin, its documented value is undefined, which Puppeteer describes as no margins set. Do not assume a browser-style default margin will be added automatically. Puppeteer PDFOptions interface
Rank #2
- 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
Choose page size separately from margins
Margins control the space at the edges; they do not select the paper format. Puppeteer defaults to Letter. If you set format, it takes precedence over width and height. The documented dimensions include Letter at 8.5 × 11 inches and A4 at 210 × 297 millimeters. Puppeteer PaperFormat type Puppeteer PDFOptions interface
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →| Need | Set | Effect |
|---|---|---|
| Choose a standard paper size | format: 'Letter' or format: 'A4' |
Uses the selected format; if format is supplied, it takes precedence over width and height. |
| Specify dimensions directly | width and height |
Sets dimensions when a higher-priority format is not supplied. |
| Let CSS choose page size | Set preferCSSPageSize: true and define size in CSS @page |
CSS page size takes priority over width, height or format. |
With preferCSSPageSize omitted or false, a CSS @page size is scaled to fit the PDF option’s paper size. This option documents precedence for page size; it does not establish a general precedence rule for conflicts between API margins and CSS @page margins. If both define margins, check the result on the Puppeteer and Chrome versions your application deploys. Puppeteer PDFOptions interface
Rank #3
- 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
Account for print CSS
page.pdf() renders using print CSS media. A print stylesheet can therefore change the page layout compared with what you see in a normal browser window. If you specifically need screen-media styling, call page.emulateMediaType('screen') before generating the PDF:
await page.emulateMediaType('screen');
await page.pdf({
format: 'A4',
margin: {
top: '20mm',
right: '15mm',
bottom: '20mm',
left: '15mm',
},
path: 'output.pdf',
});
Use screen media only when that is the intended output; otherwise, review the page’s print styles when the PDF differs from the screen view. Puppeteer Page.pdf() method
Rank #4
- 5 ream case (2,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
Check the result and troubleshoot layout problems
- The PDF has unexpected whitespace: confirm that every margin edge has the value you intended. An omitted
marginobject does not set margins. Also check the page’s print styles. - The PDF uses the wrong paper dimensions: check whether
formatis set, because it takes priority overwidthandheight. If CSS should determine the size, setpreferCSSPageSize: trueand define the size in@page. - The output differs from the browser view: PDF generation uses print media by default. Inspect print-specific CSS, or explicitly emulate screen media before calling
page.pdf()if screen styling is required. - CSS and API margins conflict: the cited API references do not establish universal precedence for that interaction. Test the exact stylesheet, Puppeteer version and Chrome version used in deployment rather than relying on an assumed rule.
- The physical margin is unclear: use a string with an explicit unit, such as
'0.5in'or'15mm', rather than relying on an undocumented conversion assumption.
Or skip the browser setup
For a screenshot or PDF from a URL without setting up Puppeteer, ScreenshotNeo offers a single-request API. Its PDF options include paper size and margins. See the ScreenshotNeo documentation for request options and authentication.
Recommended Free Tools
Quick Recap
Best Value
- 8 ream case (4,000 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
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo removes 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, and the Free plan includes 1,000 shots per month with no card required; paid plans start at $5 for 3,000 shots.
Create a free ScreenshotNeo account.
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.




