Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →To remove an unwanted page break in a Puppeteer PDF, first find the print rule creating it, then override the relevant break-before, break-after, or break-inside declaration. If the apparent break is really a paper-size or margin problem, fix @page and PDFOptions instead. Puppeteer renders PDFs in print media by default, so diagnose the document in that same mode.
This guide shows how to identify forced breaks, keep suitable blocks together, choose between CSS and PDF sizing controls, and troubleshoot cases where a rule appears to do nothing.
Why Puppeteer inserts page breaks
page.pdf() generates output using the print CSS media type. A stylesheet inside @media print, a global rule, or a component library can therefore change pagination even when the screen view looks correct. Puppeteer does not have a single “remove all page breaks” switch: pagination follows CSS fragmentation rules and the printable area available on each sheet.
Inspect the generated PDF in print mode and look for three causes:
#1 Best Overall
- EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
- READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
- CREATE, COMBINE, SCAN and COMPRESS PDFs
- FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs
- LIFETIME License for 1 Windows PC or Laptop. 5GB MobiDrive Cloud Storage Included.
- A forced boundary on the element or its predecessor:
break-before: page,break-after: page, or their legacypage-break-*equivalents. - A constraint intended to keep a box together, such as
break-inside: avoid, that pushes the whole box to the next page. - Paper dimensions, margins, or scale that leave too little room, making a natural break look like a forced one.
MDN’s CSS fragmentation guide and paged-media guide describe how these constraints interact.
Remove a forced break with print CSS
Override the rule on the element
Locate the element that always starts a new page and override its print declaration. Use the current properties rather than adding more legacy aliases:
@media print {
.section-start {
break-before: auto;
}
.previous-section {
break-after: auto;
}
}
If a more specific selector or an inline style wins, match or exceed its specificity, or remove the declaration in the component stylesheet. A break-before rule has no effect when the element does not generate a box; verify that the selector matches a rendered element. See MDN’s break-before reference.
Keep a small block from splitting
When the problem is a card, heading-plus-table, or other compact unit being split, apply break-inside: avoid to the smallest block that should remain intact:
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #2
- Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.
- Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
- Read & Annotate. Enjoy intuitive reading modes and powerful tools to comment, highlight, and mark up PDFs.
- Create & Manage PDFs. Create new PDFs, combine multiple files, scan documents, and compress for easy sharing.
- Fill & Sign Forms. Complete forms and digitally sign documents with secure e-signature tools.
@media print {
.keep-together {
break-inside: avoid;
}
}
This is a request to the pagination algorithm, not a guarantee and not a way to create more printable space. If the block is taller than one page, Chromium must split it or move portions; applying avoid to long articles can create large blank areas. The deprecated page-break-inside property remains a compatibility alias for auto and avoid. Prefer break-inside in new code and retain the old spelling only when compatibility testing requires it.
Use a scoped print stylesheet
Keep PDF-only behavior out of the screen layout:
@media print {
.section-start { break-before: page; }
.keep-together { break-inside: avoid; }
}
To remove an existing forced break, override that class in the same print block or delete the original declaration. Change one rule at a time and regenerate the PDF so you can identify which constraint changed the result.
Confirm Puppeteer is using the stylesheet you expect
Choose print or screen media deliberately
By default, Puppeteer uses print media for page.pdf(). If the application intentionally wants screen styles, call page.emulateMediaType('screen') before generating the file:
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle0' });
await page.emulateMediaType('screen');
await page.pdf({ path: 'screen-style.pdf', printBackground: true });
await browser.close();
This changes the active style environment; it does not selectively erase a page-break declaration. If your print layout is intentional, leave the default print media type and correct the print rules instead. Puppeteer documents the behavior in its Page.pdf() method reference and PDF generation guide.
Rank #3
- Create and edit PDFs. Collaborate with ease. E-sign documents and collect signatures. Get everything done in one app, wherever you go.
- Edit text and images without jumping to another app.
- E-sign documents or request e-signatures on any device. Recipients don’t need to log in to e-sign.
- Convert PDFs to editable Microsoft Word, Excel, or PowerPoint documents.
- Share PDFs for collaboration. Commenting features make it easy for reviewers to comment, mark up, and annotate.
Separate break placement from page size
Define the sheet in CSS
A page can appear to “break early” because its usable height is reduced by the selected paper size or margins. Define the intended sheet with @page:
@page {
size: A4;
margin: 16mm 14mm;
}
@media print {
body { margin: 0; }
}
Use Puppeteer PDF options consistently
page.pdf() accepts options including format, width, height, margin, scale, printBackground, and preferCSSPageSize. The documented default for preferCSSPageSize is false; with that setting, Puppeteer fits the page to the selected paper size. Set it to true when the CSS @page size should take priority over format, width, or height:
await page.pdf({
path: 'report.pdf',
printBackground: true,
preferCSSPageSize: true,
margin: {
top: '12mm',
right: '12mm',
bottom: '12mm',
left: '12mm'
},
scale: 1
});
Do not use preferCSSPageSize as a break-removal switch. It resolves conflicts between CSS page dimensions and Puppeteer’s size options. Changing margins or scale can alter where natural breaks fall, so verify text size and readability after every change. The complete option list is in Puppeteer’s PDFOptions interface.
A repeatable diagnosis workflow
- Reproduce in print mode. Open DevTools’ print emulation or rely on Puppeteer’s default print media, then inspect the element at the break.
- Check forced declarations. Search all stylesheets, including component and
@media printfiles, forbreak-before,break-after,page-break-before, andpage-break-after. - Check constraints on both sides. A break can result from the previous element’s
break-after, the next element’sbreak-before, or an ancestor’s layout rules. Break properties interact; changing only one side may not be enough. - Test the smallest override. Set the unwanted forced property to
auto. If a block is being split, addbreak-inside: avoidonly to that block. - Verify physical fit. Compare the block’s height with the printable area after margins and scale. Remove an avoid rule from content that cannot fit on one sheet.
- Check dimensions. Align
@pagewithformat/width/height, then decide whetherpreferCSSPageSizeshould be true. - Regenerate after fonts load. Puppeteer’s PDF guide states that PDF generation waits for fonts by default. Still, confirm the final rendered metrics in your own page when font-dependent wrapping matters.
Common symptoms and fixes
A block always starts on a new page
Inspect that block’s break-before and the preceding block’s break-after, including print-only rules. Override the unintended declaration with auto. If the rule comes from a library, place your override later or use a deliberately scoped selector.
Windows 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 reinstallCrashes, 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 minuteRank #4
- Perfect Adobe Acrobat Pro alternative – lifetime license for Windows 10 and 11.
- EDIT text, images, pages, hyperlinks, designs in PDF documents. ORGANIZE PDFs.
- READ and Comment on PDFs – Intuitive reading modes & document commenting and mark up tools!
- CREATE, COMBINE, SCAN and COMPRESS PDFs.
- FILL forms & Digitally Sign PDFs. Work with Digital certificates
An element is split despite break-inside: avoid
Apply the property to the actual generated box, not just a wrapper with no box in the print layout. Then confirm the box can fit in the remaining printable area. The property is a constraint, so Chromium may still split content when avoiding the break would violate other constraints or when the content is too tall.
The rule appears to do nothing
Confirm that print media is active, the selector matches, and no more-specific declaration wins. Inspect computed styles and check interacting before, after, and inside properties. A break declaration on an element that generates no box is ignored.
The PDF is scaled or pagination shifts after changing paper size
Compare CSS @page size, Puppeteer’s format/width/height, margins, and scale. Set preferCSSPageSize: true when CSS should control the sheet. Do not attempt to solve a size mismatch with break rules.
A legacy stylesheet uses page-break-inside
Translate new code to break-inside. Keep the legacy spelling only if tests show an older browser or embedded Chromium version needs the alias.
Best Value
- ALL-IN-ONE SOLUTION – read, edit, convert, merge and protect your PDF files
- MAXIMUM FUNCIONALITY – create interactive forms, compare PDFs, bates numbering, find and replace text or colors, convert documents, OCR engine, comment, highlight, fill out and print forms, document protection and others
- EASY TO INSTALL AND USE – well-structured user-interface, in-program instructions, free tech support whenever you need it
- GREAT VALUE FOR MONEY - why spend a fortune if you can have maximum functionality at a reasonable price - this also fits the requirements of companies very well
Or skip the browser setup
For a direct URL-to-image or PDF workflow, ScreenshotNeo provides a website screenshot API and MCP server. A GET request returns PNG, JPEG, WebP, or PDF, while its capture options cover full-page pages, CSS selectors, device and retina settings, PDF paper and margins, custom CSS/JavaScript, waits, request blocking, authentication headers and cookies, geolocation, caching, resizing, signed links, asynchronous webhooks, bulk capture, and usage reporting.
It also accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.
Example using the documented API pattern (see the ScreenshotNeo documentation):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Equivalent Python and Node.js calls:
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)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
The Free plan includes 1,000 screenshots per month without a card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Create a free ScreenshotNeo account to try it.
Performance, reliability, and cost considerations
- Prefer one targeted CSS override over broad global rules; this reduces unexpected pagination changes elsewhere.
- Use
networkidle0or an explicit readiness selector when page content is asynchronous, and ensure fonts and lazy content have rendered before capture. - Keep margins and scale stable across environments. Different Chromium versions can expose borderline fragmentation decisions, so test the version used in production.
- For repeated captures, cache deliberately and compare output after template or browser upgrades. A cached result can hide a change during diagnosis.
- When a document must preserve a compact component, constrain only that component. Large avoid regions can increase blank space and force more pages.
Frequently Asked Questions
Does Puppeteer have an option that removes every page break?
No. Page breaks are primarily controlled by print CSS fragmentation. PDF options change paper dimensions, margins, and scale, which can move natural breaks but do not replace CSS break rules.
Should I use emulateMediaType('screen') to stop breaks?
Only when screen styles are the intended PDF design. It switches the active media stylesheet; it does not specifically remove a break declaration.
Can break-inside: avoid keep a whole long article on one page?
No. It is a constraint, not extra space. Content taller than the printable area may still need to split.
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.
Recommended Free Tools




