The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
If an HTML page becomes unexpectedly tiny or oversized in a PDF, changing one “scale” value is rarely the complete fix. Browser converters combine print CSS, paper dimensions, margins, CSS @page rules, rendering scale, and viewport breakpoints. Correct results come from deciding which setting controls each stage, then checking the PDF’s physical page size rather than judging its viewer zoom.
The five controls that determine PDF size
In Chromium-based converters such as Puppeteer and Playwright, these settings affect different parts of the pipeline. They are related, but none is a universal replacement for the others.
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
Aviation Instructor's Handbook: FAA-H-8083-9B | $15.99 | Buy on Amazon |
| 2 |
|
Handbook of Attachment: Theory, Research, and Clinical Applications | $84.98 | Buy on Amazon |
| 3 |
|
Wilderness First Aid Handbook | $16.99 | Buy on Amazon |
| 4 |
|
The Tarot Handbook: Practical Applications of Ancient Visual Symbols | $18.14 | Buy on Amazon |
1. Media type: print or screen
PDF generation uses the print CSS media type by default. Rules inside @media print can change font sizes, widths, visibility, spacing, colors, and layout. A page that looks correct in a browser window can therefore reflow or appear smaller in a PDF.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallTo preserve screen styling, select screen media before creating the PDF:
#1 Best Overall
// Puppeteer
await page.emulateMediaType('screen');
await page.pdf({ path: 'page.pdf', format: 'A4' });
// Playwright
await page.emulateMedia({ media: 'screen' });
await page.pdf({ path: 'page.pdf', format: 'A4' });
Use print media when you intentionally maintain a print stylesheet. Inspect both your normal CSS and @media print rules before changing numeric scale.
2. Paper format and orientation
The PDF API defines the page box with a named format such as Letter or A4, or with explicit width and height. Playwright documents Letter as 8.5 × 11 inches and A4 as 8.27 × 11.7 inches. You can also request landscape orientation.
await page.pdf({
path: 'report.pdf',
format: 'A4',
landscape: false,
printBackground: true
});
Explicit dimensions may be written in px, in, cm, or mm in Playwright. Unlabeled dimensions are interpreted as pixels. Do not confuse a CSS pixel dimension with an inch-based paper size.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
3. Margins and usable content area
Margins reduce the area available to your content. A fixed-width layout may wrap when margins are increased; a layout that barely fits may be scaled down by the converter to stay inside the printable area.
await page.pdf({
path: 'report.pdf',
format: 'Letter',
margin: {
top: '0.5in',
right: '0.5in',
bottom: '0.5in',
left: '0.5in'
}
});
Set margins deliberately instead of relying on an environment’s defaults. Keep units explicit so a change of API or library version does not silently alter geometry.
4. CSS @page and API precedence
Your stylesheet can define the intended page size:
@page {
size: A4 portrait;
margin: 12mm;
}
Puppeteer and Playwright expose preferCSSPageSize. Its documented default is false; with that default, content is scaled to fit the paper size supplied through format, width, or height. Set it to true when the CSS @page declaration should take priority.
await page.pdf({
path: 'report.pdf',
format: 'A4',
preferCSSPageSize: true
});
Choose one authority for page geometry. If the API owns the size, use its format or dimensions and do not depend on an unnoticed @page override. If CSS owns it, define @page and enable the preference.
5. PDF render scale
The scale option scales the rendered page after the other geometry decisions. Puppeteer and Playwright document a default of 1 and an allowed range from 0.1 to 2.
await page.pdf({
path: 'report.pdf',
format: 'A4',
scale: 1
});
Start at 1. A modest change can correct a consistently oversized or undersized rendering, but it does not choose Letter versus A4, define the CSS page box, or replace margin and media settings.
Viewport size is not paper size
Puppeteer’s viewport uses CSS pixels and has a separate deviceScaleFactor. Viewport dimensions can trigger responsive breakpoints or scripts that measure the window, while PDF paper dimensions determine the output page. A wide viewport does not create a wide PDF.
await page.setViewport({
width: 1280,
height: 900,
deviceScaleFactor: 1
});
Control the viewport when reproducibility matters. If a breakpoint switches to a compact mobile layout, changing PDF scale will not restore the desktop layout; change the viewport or the responsive CSS.
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 →Scan for outdated or missing drivers - takes under a minuteDriver Scan →A reliable debugging sequence
- Choose the physical target. Decide Letter, A4, another format, portrait, or landscape. Confirm units and dimensions.
- Choose the page-size authority. Either use API geometry or CSS
@pagewithpreferCSSPageSize: true. - Set margins explicitly. Recheck line wrapping and available width after every margin change.
- Keep
scale: 1. Only adjust it after format, precedence, and margins are correct. - Inspect print CSS. Look for rules that change widths, font sizes, visibility, or spacing.
- Stabilize the viewport. Set a known width, height, and device scale so responsive code behaves consistently.
- Wait for late assets. Ensure fonts, images, and other resources have loaded before rendering.
- Inspect the actual PDF dimensions. Viewer zoom is not evidence that the page box is wrong.
Complete Puppeteer example
This script fixes the viewport, selects screen media, waits for fonts, and writes an A4 PDF with intentional margins and backgrounds.
Rank #3
- Quality material used to make all Pro force products
- Tested in the field and used in the toughest environments
- 100 percent designed in the USA
- The Wilderness First Aid Handbook is a must-have for every back pocket or backpack
- Filled with original, full-color artwork illustrating the techniques and procedures described and with internal-spiral binding and waterproof pages
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 900, deviceScaleFactor: 1 });
await page.goto('https://example.com', { waitUntil: 'networkidle0' });
await page.emulateMediaType('screen');
await page.evaluate(() => document.fonts.ready);
await page.pdf({
path: 'example.pdf',
format: 'A4',
landscape: false,
margin: { top: '12mm', right: '12mm', bottom: '12mm', left: '12mm' },
printBackground: true,
preferCSSPageSize: false,
scale: 1
});
await browser.close();
If the page’s @page rule must win, change preferCSSPageSize to true and verify that the stylesheet declares the intended size.
Complete Playwright example
import { chromium } from 'playwright';
const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1280, height: 900 }, deviceScaleFactor: 1 });
await page.goto('https://example.com', { waitUntil: 'networkidle' });
await page.emulateMedia({ media: 'screen' });
await page.evaluate(() => document.fonts.ready);
await page.pdf({
path: 'example.pdf',
format: 'A4',
margin: { top: '12mm', right: '12mm', bottom: '12mm', left: '12mm' },
printBackground: true,
preferCSSPageSize: false,
scale: 1
});
await browser.close();
Why a PDF looks too small
The content is being fit into a smaller paper box
Check whether the API format is smaller than the design’s intended page and whether margins consume much of the width. Use the target format explicitly, then compare with @page.
A print stylesheet changes the design
Search for @media print. Temporarily use screen media to determine whether print rules are responsible; then fix the specific print rule rather than applying an extreme global scale.
Free tools Windows power users keep installed
One-click scans. No signup required.
CSS and API page sizes disagree
Inspect @page and the PDF options together. Either remove the conflict or enable preferCSSPageSize when CSS should be authoritative.
The layout is responsive
Set a viewport that stays on the required breakpoint. Viewport width is independent of paper format, so changing scale cannot select a desktop layout.
Fonts or images arrive late
Wait for network idle where appropriate and wait for document.fonts.ready. A fallback font can change line breaks and page count even when the nominal scale is correct.
Rank #4
- Used Book in Good Condition
Backgrounds are missing
printBackground is documented as false by default in Puppeteer. Set it to true when background graphics are part of the design.
Performance, reliability, and version checks
Waiting for every request to become idle can be inappropriate for pages with analytics or long-lived connections. Select a readiness condition that matches the page, such as a specific selector plus a short delay. Keep browser, Puppeteer, or Playwright versions fixed in repeatable jobs and verify the installed API documentation: defaults can differ in non-browser converters or wrappers.
Test representative pages at their actual paper size, including long tables, web fonts, lazy images, print-only elements, landscape pages, and pages near a responsive breakpoint. Compare page dimensions, line wrapping, page count, and required backgrounds—not only a screenshot at a convenient zoom.
Or skip the browser setup
ScreenshotNeo provides a website screenshot and PDF API when you want a hosted capture instead of maintaining Chromium setup. A single GET request can return a PDF, with options for paper size, margins, landscape mode, and page ranges. Before capture, it accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result.
See the ScreenshotNeo API documentation for the complete parameter list. cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
For PDF output, add the documented PDF parameters to the same request. ScreenshotNeo also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. Every feature is included on every plan; 1,000 screenshots per month are free with no card, and paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
Frequently Asked Questions
Does changing PDF scale change Letter to A4?
No. Use the PDF format or explicit width and height for paper geometry; scale only changes rendering size within that geometry.
Should I use CSS @page or the API format?
Use one as the authority. If CSS should control the page, enable preferCSSPageSize; otherwise define the API format or dimensions explicitly.
Why does the same URL produce different PDFs?
Differences in print versus screen media, viewport breakpoints, loaded fonts, margins, browser versions, or CSS page-size precedence can all change the result.
Quick Recap
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.

