Start with page-break-inside: avoid, but treat it as a best-effort mitigation, not a guarantee. Apply it to the smallest block that must stay together (or to a table row), verify the exact wkhtmltopdf binary and its patched-Qt status, and inspect a PDF rendered with production settings. If the content is taller than the printable page area, no CSS rule can keep it intact; split or restructure it.
Identify what is actually breaking
“Line break” can describe several different pagination failures. The fix depends on the boundary:
- A text line: characters from one line appear at the bottom and top of different pages.
- A block: a paragraph, card, callout, or other element is divided between pages.
- A table cell or row: a row starts on one page and continues on the next.
A rule on tr cannot protect an ordinary div, and a rule on a wrapper may not control WebKit’s internal table layout. Reproduce the exact failure before changing CSS.
The first CSS mitigation
Use the legacy print property on the smallest practical element:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#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-together {
page-break-inside: avoid;
}
tr {
page-break-inside: avoid;
}
For a report card, apply keep-together to the card itself, not the entire document. For a table, try the row and any relevant wrapper. Render again and check the generated PDF, not only a browser preview.
The historical wkhtmltopdf man page says patched-Qt support for page-break-inside may remedy line splitting “somewhat.” Archived issue reports also document rows and lines that still split, so this declaration is a testable mitigation rather than a standards-level guarantee.
Why wkhtmltopdf behaves this way
wkhtmltopdf uses a legacy Qt/WebKit stack. The project status page says Qt 4, which wkhtmltopdf uses, has not been supported since 2015 and that the bundled WebKit had not been updated since 2012. Its historical documentation warns that WebKit can split a line across pages.
That age matters because pagination is performed by the renderer, after layout, font substitution, image loading, and table calculations. Two packages with the same command name can therefore produce different page boundaries. Archived reports include table rows splitting despite page-break-inside: avoid, content lines divided between pages, and page-break-before/after rules ignored for rows. Those reports concern particular versions and documents; they are evidence of limits, not a prediction that every build will fail.
Free tools Windows power users keep installed
One-click scans. No signup required.
Verify the renderer before debugging CSS
- Record the version: run
wkhtmltopdf --versionand save the complete output. - Check for patched Qt: the output normally identifies whether the binary is “with patched qt.” The partial CSS support described in the historical documentation is associated with patched-Qt builds.
- Record the environment: operating system/package source, installed fonts, page size, margins, zoom, and any command-line switches.
- Use the production binary: a desktop preview or a different container does not prove how your deployed renderer will paginate.
Keep this information with a failing PDF. It makes regressions attributable when an operating-system package or font update changes the layout.
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.
Build a minimal reproduction
Reduce the document to the smallest fixture that still breaks. Keep the production page size, margins, fonts, images, and content shape. Generate it with the exact binary and inspect the page boundary in a PDF viewer.
A useful fixture contains one heading, the problematic block or row, and enough preceding content to place the boundary at the same location. Remove JavaScript, external assets, and unrelated styles one at a time. If the break disappears, add the removed dependency back until the cause is isolated.
Do not infer pagination from an HTML browser view. Browser print preview may use a newer engine, different font metrics, or different margin defaults.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsWhen “avoid” cannot work
A keep-together rule cannot make an element taller than the printable area fit on one page. Printable height is the paper height minus top and bottom margins (and any header or footer space). A long table row, image, or code listing may simply be too tall.
- Shorten the content or reduce unnecessary vertical padding.
- Split one oversized row into several meaningful rows.
- Divide a long table into sections that can paginate independently.
- Move an independently paginated report component into its own block.
- Allow an intentional break at a semantic boundary rather than an accidental break inside a sentence.
After restructuring, check table-header repetition, border drawing, whitespace, and any forced breaks. A change that prevents a row split can move a large amount of blank space to the previous page.
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.
A controlled troubleshooting sequence
1. The declaration has no effect
Confirm that the selector matches the element that actually crosses the boundary and that the stylesheet is loaded by wkhtmltopdf. Rules on tr do not protect a nested block that is taller than the page. Check the computed style in your source and then verify the PDF output.
2. A table row still splits
Try page-break-inside: avoid on the row and the table’s relevant wrapper, then render a minimal fixture. Archived issue reports show that this can still fail in some documents. Do not treat changing a row to inline-block as a proven general solution; issue comments mention display changes, but they do not establish reliable behavior.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →3. The row moves, but borders or whitespace look wrong
Inspect the page before and after the move. WebKit may draw borders at the page edge, repeat a header differently, or leave unused space when a row is moved. Simplify nested tables and split the table deliberately if the visual result is unacceptable.
4. A forced page break is ignored
Test page-break-before or page-break-after on a block wrapper rather than directly on a table row. Archived reports document ignored forced breaks on rows, so use a structural wrapper and confirm the result in the PDF.
5. The break changes between machines
Compare version output, patched-Qt status, fonts, page size, margins, and command switches. A missing font can change line wrapping enough to move a block to another page. Package the required fonts and pin the renderer environment where reproducibility matters.
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
6. A page is blank or content is missing
Separate pagination from loading problems. First produce a fixture with inline HTML and local fonts. Then add remote images, stylesheets, and scripts one at a time. Only after the content is consistently loaded should you evaluate page-break behavior.
Make pagination deliberate in your document structure
Keep related content in a compact wrapper, but do not wrap an entire multi-page report in page-break-inside: avoid. Use semantic sections such as an invoice line-item group, a definition list, or a short callout. For long data sets, create manageable table sections and decide where a new section may begin.
Prefer stable dimensions when exact pagination matters: explicit page size, margins, predictable font sizes, and known image dimensions. Dynamic content, late-loading fonts, and unbounded text make a keep-together request harder for a legacy renderer to honor.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.When to replace wkhtmltopdf
If controlled report PDFs remain unreliable after you have pinned the binary and simplified the document, compare a renderer change against your requirements:
| Decision axis | Questions to answer |
|---|---|
| HTML/CSS fidelity | Does the candidate reproduce your existing templates, fonts, tables, and print styling? |
| Pagination | Does it keep representative rows and blocks together without unacceptable whitespace or border changes? |
| JavaScript | Does the document require a dynamic site, client-side data, or browser APIs? |
| Deployment | Can it run on your operating systems, containers, and build pipeline? |
| Cost and licensing | Are commercial licensing, hosting, and operational costs acceptable for your use? |
The wkhtmltopdf project names WeasyPrint and Prince for controlled report generation and Puppeteer (or a wrapper around it) for sites that depend on dynamic JavaScript. The candidates have different CSS, JavaScript, deployment, and licensing characteristics; validate each against the same fixture rather than assuming a migration will preserve pagination.
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.
Or skip the browser setup
If your actual requirement is a reliable image or PDF capture of a web page rather than preserving a wkhtmltopdf template, ScreenshotNeo provides a website screenshot API and MCP server. It accepts consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; 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 whether it was billed.
One GET request returns a PNG, JPEG, WebP, or PDF. See the parameter reference in 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
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}`);
For AI workflows, its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients. Other options include full-page capture with lazy images loaded, CSS-selector element capture, device presets or custom viewports, retina scale, PDF paper settings and page ranges, custom CSS/JavaScript, click and wait actions, request blocking, headers/cookies/user agents, timezone and geolocation, transparent backgrounds, resizing, caching with a chosen TTL, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, and a usage API/OpenAPI specification.
The Free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; yearly billing gives two months free, and every feature is included on every plan. Sign up for the free plan.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Final validation checklist
- Identify whether the failure is a line, block, cell, or complete row.
- Capture
wkhtmltopdf --version, patched-Qt status, fonts, dimensions, and switches. - Apply
page-break-inside: avoidonly to the relevant element. - Render a minimal fixture with the production binary.
- Inspect the PDF itself for splits, whitespace, borders, and repeated headers.
- Split content that cannot physically fit on one page.
- Set a replacement threshold and compare candidate renderers on representative documents.
Frequently Asked Questions
Does page-break-inside: avoid guarantee an unbroken table row in wkhtmltopdf?
No. The historical documentation describes the patched-Qt behavior as partial, and archived issue reports show rows that still split. Verify the generated PDF with your exact binary and document.
Can CSS keep a block taller than a page together?
No. If the block exceeds the printable page height, it must be shortened, split, or allowed to paginate.
Is a browser preview enough to validate the fix?
No. Render a PDF with the production wkhtmltopdf binary, fonts, page size, margins, and command-line options, then inspect that file.
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.

