iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Use print CSS to control where Headless Chrome splits PDF content: apply break-inside: avoid to components that should stay together, use break-before: page when a section must start on a fresh page, and set the sheet size and margins with @page. These rules guide pagination; they cannot keep an element intact if it is taller than the usable page area, so regenerate and inspect the PDF after each change.
Why Headless Chrome breaks content across pages
When Chrome prints a document, it lays content out across pages using CSS fragmentation. A page is a fragmentainer: a box may fit within one page, or split across page boundaries when the layout permits. Chromium’s documentation describes block fragmentation and the search for acceptable unforced break points; LayoutNG block fragmentation initially shipped in Chrome 102. That implementation detail is not a guarantee that every browser engine or older Chrome build will paginate identically. Chromium’s fragmentation documentation
The two most useful rules solve different problems. break-inside: avoid asks the browser not to split a particular box internally. break-before: page forces a page break before an element. Neither identifies the right element for you: the selector must match the component or section you intend to control.
Start with these print CSS rules
@media print {
@page {
size: A4;
margin: 18mm;
}
.keep-together {
break-inside: avoid;
}
.new-page {
break-before: page;
}
}
This is a starting pattern, not a guaranteed fix for every document. Change the example page size and margins to match the intended output, and add the classes to the elements whose pagination you want to control. Chrome and Firefox support @page for printed page size and margins. Chrome’s guide to printed page margins
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Keep one component together
Put keep-together on a meaningful unit such as a card, short list, or heading-and-content group that should not be split. If the group cannot fit in the remaining space, the browser may move it to another page. If it is taller than the usable page area, it cannot fit intact on a single page; expect overflow or a split rather than assuming avoid can override the page geometry.
Start a section on a new page
Put new-page on the section element that must begin on a fresh page. Since break-before: page acts before that element, applying it to the preceding element would force the break at the wrong boundary.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Set the printable page area
The @page rule defines page dimensions and margins, which determine the area available to the document’s content. A change to paper size or margins can alter pagination throughout the PDF, so check the full document rather than only the first awkward break.
Recommended Free Tools
Diagnose the first bad break systematically
- Confirm the output path. Identify the Chrome build and whether you print through a dialog, the command line, or an automation library. Pagination behavior depends on the browser and the document’s CSS.
- Find the first incorrect split. Use print preview or save a PDF, then inspect the first page boundary that breaks the intended layout. Determine which element is split and where the next section begins.
- Check print-inherited layout constraints. Look for fixed heights or
overflowclipping from the screen layout. If they cause trouble in print, override them in@media printrather than changing screen styles unnecessarily. - Apply the narrowest useful break rule. Use
break-inside: avoidon a component to discourage an internal split, orbreak-before: pageon a section that needs to start on a new sheet. - Set the page dimensions, regenerate, and inspect every page. Check for newly created blank space, overflow, or a different bad break elsewhere. Adjust one change at a time so its effect is clear.
This is a diagnostic sequence based on the documented print-fragmentation model, not a verified fix for a particular page. Without the page’s HTML, CSS, Chrome version, and intended paper dimensions, no exact selector or final stylesheet can be prescribed.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Generate and inspect the PDF with Headless Chrome
Chrome’s command-line reference documents --headless --print-to-pdf for creating a PDF. For example, a basic invocation is:
chrome --headless --print-to-pdf=output.pdf https://example.com
Use the executable name and any required environment-specific options for your installation. If you do not want Chrome’s generated date, URL, and page-number decorations, add --no-pdf-header-footer. This flag controls browser-generated headers and footers; it does not change the content margins set by @page. The --timeout option sets a maximum wait before capture when content is still loading, so choose a value that fits the page’s actual loading behavior. Chrome Headless command-line reference
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
For an application pipeline, Puppeteer provides a high-level API for automating Chrome and Firefox, including PDF generation. It is one option for repeatable PDF workflows, not a prerequisite for fixing CSS pagination. Puppeteer overview
When “break-inside: avoid” does not solve it
- The content is taller than a printable page. It cannot remain intact within the usable page area; reduce its height or allow it to split.
- The wrong element has the rule. Move the class to the box that actually needs to stay together, or to the section that should start on a new page.
- The page geometry is not what you expect. Verify
@pagesize and margins against the intended paper dimensions, then regenerate. - A screen layout constraint carries into print. Inspect fixed heights and overflow clipping, and adjust them in print-specific CSS where appropriate.
- The issue is decoration at a split, not the split location. Chromium added block-fragmentation support for
box-decoration-break: clonein Chrome 130; this affects how box decoration such as borders appears when a box fragments, rather than serving as the primary page-break control. Chrome’s article on box-decoration-break in Chrome 130
Distinguish page margins from browser headers and footers
CSS page margins reserve space around printed content. Chrome’s generated headers and footers are separate decorations, which can be disabled in the print dialog or suppressed in headless command-line output with --no-pdf-header-footer. Chrome 131 added generated content in page margin boxes, as described in its October 30, 2024 article; that capability concerns content placed in the page margins, not a substitute for controlling where document elements break. Chrome’s printed-page margins guide Headless command-line options
Quick Recap
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
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.

