Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Short answer: wkhtmltopdf does not reliably keep table rows joined by rowspan together across a page boundary. You can test page-break-inside: avoid, but it is not a dependable fix. Reduce the layout to a small reproduction, render it with the exact production build and settings, and inspect the spanning cell as well as the adjoining rows. If the group still breaks, compare another renderer against that same reproduction—or design a fallback for groups that cannot fit on one page.

Why a rowspan can break at a page boundary

A cell with rowspan occupies space across two or more table rows. When a page ends between those rows, the renderer must paginate the cell and the rows as a related unit. Historical wkhtmltopdf issue reports describe cases where pagination did not handle that relationship correctly: a spanning cell could have an unexpected height when a later row moved to the next page, or the pagination logic could fail to account for the cell spanning multiple rows.

That makes this different from a simple row that happens to split. A PDF can look wrong even if the text appears to have moved together: the spanning cell’s dimensions, borders, or background may no longer line up with the rows next to it. Inspect the whole table geometry, not just where the text falls.

The reports are setup-specific, not proof that every wkhtmltopdf build fails in the same way. One report concerned wkhtmltopdf 0.12.5 on Ubuntu 18; another relevant report dates to 2016. Treat them as evidence of known pagination problems, not as a universal reproduction or a guide to which current build will behave a particular way.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Brother DCP-L2640DW Wireless Compact Monochrome Multi-Function Printer, Copy, Scan, Duplex, Mobile Printing
  • BEST FOR SMALL BUSINESSES – Engineered for extraordinary productivity, the Brother DCP-L2640DW Monochrome (Black & White) 3-in-1 combines laser printer, scanner, copier in one compact footprint and delivers high-quality black & white prints
  • FAST PRINTER WITH EFFICIENT SCANNING – Produces documents quickly with print speeds up to 36 ppm(2) and scan speeds up to 23.6/7.9 ipm(3) (black/color). A 50-page auto document feeder(4) allows for convenient, time saving multi-page scanning and copying
  • FLEXIBLE CONNECTION OPTIONS – Easily navigate the changing demands of your business with secure multi-device connectivity via built-in dual-band wireless (2.4GHz / 5GHz) and Ethernet. Or connect locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Print, scan, and manage your wireless printer anytime, from almost anywhere from your mobile device. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(5)
  • CHOOSE BROTHER GENUINE TONER – When it’s time to replace your toner, be sure to choose Brother Genuine TN830 or TN830XL replacement toner. And with Refresh EZ Print Subscription Service, you’ll never worry about running out of toner again and you’ll enjoy savings of up to 50%(6) on Brother Genuine Toner. Get started with Refresh today with a Free Trial(1)

Does page-break-inside: avoid fix it?

It is worth testing, but do not rely on it as a guarantee for a rowspan group in wkhtmltopdf. A 2016 issue example already applied page-break-inside: avoid to table rows and still described a problem. In the directly matching user report, the author tried page-break-before, page-break-after, and page-break-inside on rows without getting the intended result.

A wkhtmltopdf maintainer described the page-break-inside behavior as a table-level workaround that failed in some cases and would not be easy to fix without rewriting existing code. The upstream GitHub repository was archived on January 2, 2023, and is read-only. Do not assume that historical issue activity means a later fix is available.

Also distinguish a successful-looking text layout from a successful table layout. Check whether the spanning cell’s border and background continue correctly, whether adjacent row borders meet, and whether cell heights remain sensible on both pages. A CSS declaration that appears to keep text on one page may not have preserved the table’s intended structure.

Build a reproduction that matches the failure

Before changing production markup, isolate the smallest table that still fails. A useful reproduction preserves the conditions that affect its geometry; removing content or styles can make the page break disappear and obscure the actual issue.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Brother HL-L2405W Wireless Compact Monochrome Laser Printer with Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOMES & HOME OFFICES – Engineered for consistent, premium print quality, the Brother HL-L2405W Monochrome (Black & White) Laser Printer delivers sharp, crisp prints at an affordable price. Prints one-sided documents at speeds up to 30ppm(2)
  • COMPACT, CONNECTED PRINTER – Flexible connection options make this an ideal printer for home use and at-home offices. Securely connect to multiple devices with built-in dual-band wireless (2.4GHz/5GHz) or locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Manage your printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Enjoy seamless, reliable everyday printing with the 250-sheet paper tray(4) and a manual feed slot that enables printing on envelopes and specialty pape
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer

Keep the layout-affecting details

  • Use the same rowspan values and the same arrangement of rows as the failing table.
  • Keep comparable text lengths and wrapping. A shorter test cell may reduce row heights and move the page boundary.
  • Retain the table styles that affect cell dimensions, borders, backgrounds, and spacing.
  • Use the same page dimensions and the same fonts as the production PDF.
  • Render with the same wkhtmltopdf binary and operating-system environment used in deployment.

Record the build, Qt variant if known, operating system, page size, and relevant font setup alongside the reproduction. A test made with a different binary or layout is not a reliable answer about production behavior.

Use a small table to make the failure visible

The following is a structural example, not a guaranteed reproduction: adjust its content and styles until it preserves the geometry of your failing case. Add enough content in the ordinary cells to put the page boundary through the rowspan group.

<table>
  <tbody>
    <tr>
      <td rowspan="2">Spanning cell</td>
      <td>First row content; add text to match production wrapping.</td>
    </tr>
    <tr>
      <td>Second row content; preserve the failing row height.</td>
    </tr>
  </tbody>
</table>

The important part is not the sample text; it is making the reproduction retain the row heights, spanning relationship, and page placement that fail in your real document. Once it reproduces the issue, make one change at a time so you can tell whether the output actually changed.

Test the CSS rule, then inspect both pages

  1. Render the unmodified reproduction. Save the PDF and note where the page boundary intersects the table.
  2. Try the rule on rows as a diagnostic. Add tr { page-break-inside: avoid; } to the test stylesheet. Do not treat the declaration itself as evidence of success.
  3. Render again with the same environment. Keep the binary, page size, fonts, and input identical so that the CSS change is the only meaningful difference.
  4. Inspect the spanning cell and its neighboring rows. Check text placement, cell height, border continuity, background continuity, and alignment on both sides of the page break.
  5. Repeat with the production-sized case. A reduced table can isolate the cause, but the final decision must be checked against the actual layout and content.

If the rule has no effect, or only makes the text appear less fragmented while leaving the cell geometry wrong, it has not solved the pagination problem. If it works in one short sample but fails when text, fonts, or page placement change, it is not a robust production fix for that document.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only
  • FAST PRINT SPEEDS: Print up to 19 pages per minute.
  • COMPACT DESIGN: Space-saving, compact design fits anywhere in your home, school or small office.
  • WIRELESS CONNECTIVITY: Print from almost anywhere in your workspace using your compatible mobile device.
  • PAPER CAPACITY: Up to 150 sheets.
  • SUSTAINABILITY: Uses less than 2 watts in Energy Saver mode.

Consider grouping rows only when the markup semantics allow it

One proposed direction is to group rows that must stay together in a logical <tbody> and apply page-break-inside: avoid to that group. A directly matching report said this approach worked in PrinceXML, but the author could not get the intended result in wkhtmltopdf. That is evidence about an individual report and a different rendering engine—not proof that <tbody> grouping repairs wkhtmltopdf pagination.

If you test grouping, do so only when the rows genuinely form a logical table group. Do not silently change table semantics or accessibility just to influence pagination. Render the grouped version in the same wkhtmltopdf setup and inspect the same geometry as before. Keep the change only if it behaves correctly for the actual document, including its spanning-cell borders and backgrounds.

What if the rowspan group is taller than the printable page?

A no-split preference cannot make content fit where there is not enough printable space. If the whole group exceeds the available page area, the renderer has no single-page placement that keeps the group intact. Decide on a deliberate fallback rather than expecting CSS to create room.

  • Allow that group to split if a split is acceptable for the document.
  • Divide the content into smaller logical units if the data and table meaning permit it.
  • Change the page layout if a different page arrangement gives the group enough room.

After choosing a fallback, check the resulting PDF. Confirm that the output remains understandable and that row relationships, borders, and repeated visual cues make sense. The goal is a predictable document, not merely a CSS rule that suppresses one observed break.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Brother HL-L2460DW Wireless Compact Monochrome Laser Printer with Duplex, Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOME OFFICES & SMALL TEAMS – Engineered for consistent, premium print quality, the Brother HL-L2460DW Monochrome (Black & White) Laser Printer produces documents that are clear, crisp, and easy to review and share, all at an affordable price
  • COMPACT, CONNECTED, EXCEPTIONALLY EFFICIENT– Connect with built-in dual-band wireless (2.4GHz/5GHz), Ethernet, or to a single computer via USB interface. Prints at speeds up to 36ppm(2), plus automatic duplex printing saves time and reduces paper waste
  • BROTHER MOBILE CONNECT APP – Manage your wireless printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Tackle high-volume black & white printing with the 250-sheet capacity paper tray.(4) The manual feed slot enables printing on envelopes and specialty paper
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer

When to compare another renderer

If a minimal reproduction still breaks in the production wkhtmltopdf environment, render that same case in a candidate alternative before deciding to migrate. The available historical reports do not establish which current renderer is best, or which one will handle your document correctly. A representative test is more useful than a general claim about a product.

Compare the properties that affect your output:

  • Whether the rowspan group stays intact in the reproduced case, including when it approaches a page boundary.
  • How the engine behaves when the group is taller than the remaining printable area.
  • Repeated table headers, border and background continuity, and font and page-size fidelity.
  • CSS support relevant to the document, along with runtime and deployment requirements.
  • Maintenance status, licensing, and cost for your use case.

Keep the reproduction and its expected output available during evaluation. Otherwise, a renderer may appear to fix the issue simply because its test document no longer exercises the failing layout.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting: common reasons a test misleads

The rule is present, but the rowspan still breaks

page-break-inside: avoid is not a dependable guarantee for wkhtmltopdf table pagination. Confirm that the test renders the intended CSS and binary, then inspect the cell dimensions and borders. If the problem remains, evaluate a structural change only where semantics allow it, or compare another renderer using the same reproduction.

The text looks joined, but the table looks damaged

Check the spanning cell’s height and its borders and background across the page boundary. A text-only check can miss a geometry error. Judge the PDF as a table, including adjoining rows, rather than only by whether a phrase appears on one page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
HP LaserJet M209dw Wireless Printer, Print, Fast speeds, Easy Setup, Mobile Printing, Best-for-Small Teams, Instant Ink Eligible
  • HP LaserJet M209dw Wireless Printer, Print, Fast speeds, Easy setup, Mobile printing, Best-for-small teams, Instant Ink eligible
  • Perfect for small teams printing black & white documents and reports, plus auto two-sided printing. Perfect for 1-5 people
  • FASTEST TWO-SIDED PRINTING IN ITS CLASS – Up to 30 black-and-white pages per minute single-sided, u up to 19 black-and-white images per minute two-sided printing
  • DUAL-BAND WI-FI WITH SELF-RESET – Automatically detects and resolves connectivity issues
  • STRONG SECURITY – Built-in security features help protect your printer from potential attacks

The problem disappears in the reduced file

The reduction may have changed row heights, text wrapping, styles, page dimensions, or fonts enough to move the page boundary. Restore those details one at a time until the small file reproduces the production failure.

A grouped <tbody> works in another engine but not wkhtmltopdf

That result is not contradictory: the cited report described success with PrinceXML and failure to get the intended result with wkhtmltopdf. Verify the grouping in the target renderer, and do not treat behavior in one engine as a fix for another.

The group cannot fit on the page

Choose an explicit fallback: allow the group to split, divide it into smaller meaningful units, or alter the page layout. A no-split instruction cannot make an over-height group fit as one page unit.

Or skip the browser setup

ScreenshotNeo is a website screenshot API, not a wkhtmltopdf pagination repair. It can be useful for obtaining a screenshot of a page while you inspect layout, but it does not establish that a rowspan group will paginate correctly in a PDF. One GET request returns a screenshot or PDF; the example below requests a WebP screenshot of a URL. See the ScreenshotNeo documentation for the API details.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
  • Cookie/consent banners are accepted before capture, and 60+ known consent platforms, newsletter popups, and chat widgets are removed; each step can be turned off.
  • Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing; response headers say which verdict applied and whether the shot was billed.
  • An MCP server gives AI agents tools for screenshots, page information, and PDF capture.
  • The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Conclusion

For wkhtmltopdf, treat page-break-inside: avoid as a test, not a promise. Reproduce the failure with production-equivalent markup and rendering conditions, inspect the full rowspan geometry, and choose a fallback or alternative engine only after it passes the same representative test.

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.