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.

Extra space under the last table row in a wkhtmltopdf PDF may be a pagination effect, especially when the row falls near the bottom of a page. First check how many rows actually fit in the printable area; if the table has a fixed number of rows per page, test an explicit page break at that interval. page-break-inside: avoid alone is not a guaranteed fix: in the reported case, it moved the space to another page rather than removing it.

Why does the last row appear to have extra padding?

The symptom is reported as “random padding” beneath the last table row on a page: the HTML looks right in a browser, but the PDF rendered by wkhtmltopdf has extra blank space. The specific report involved a QR-code grid generated with wkhtmltopdf 0.12.3 with patched Qt on Mac OS 10.10.5. That is useful context, not proof that every similar-looking gap has the same cause.

Start by distinguishing actual cell padding from unused space left at a page boundary. If the gap appears only on the row where a page ends, pagination and available printable height are plausible factors. If the same row has the gap wherever it appears, inspect the CSS and content sizing too. The available reports do not establish one universal underlying defect.

In the original case, adding page-break-inside: avoid reportedly shifted the gap to a different page instead of eliminating it. An answer proposed explicit breaks for a fixed four-row layout; the answerer reported success in their example, while a commenter said the padding remained in their attempt. Treat explicit breaks as a conditional workaround to test against your own markup and renderer build, not as an engine-wide fix.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • 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.

Record the renderer and PDF settings first

Before changing CSS, capture enough context to reproduce the output. wkhtmltopdf pagination can depend on the build, page dimensions, margins, headers, footers and content, so a CSS change tested under different settings may not explain the original result.

  • Run wkhtmltopdf --version and save the full output, including whether it says “with patched qt.” Reports related to table pagination mention 0.12.3 development and 0.12.3.2 patched-Qt builds; the exact padding report used 0.12.3 with patched Qt.
  • Record the operating system, the input source (local file or URL), page size and orientation, margins, and whether headers or footers are enabled.
  • Keep a copy of the HTML, CSS and relevant assets used for a failing PDF. When testing, change one factor at a time and regenerate with the same command and settings.

A version number by itself is not a diagnosis. The value of recording it is that you can tell whether a change works for your particular renderer context and reproduce the result later.

Check how much printable space the page really has

Calculate the usable page area before adjusting row styles. The paper height is not all available to the table: margins, headers, footers and other content consume space. Compare the remaining height with the actual rendered heights of the rows and any repeated table heading.

  1. Write down the page size and orientation, then subtract the top and bottom margins.
  2. Account for header and footer space, if present, plus content before or after the table.
  3. Measure or estimate each row’s rendered height, including cell content, borders and spacing. Allow for rows that grow when text wraps or images load at a different size.
  4. Check how many complete rows fit in the remaining space. If the table is a fixed QR-code or label grid, compare this count with the intended rows per page.
  5. Inspect the generated PDF at the page boundary. Note whether the gap follows the final row, whether a row moved, and where repeated headings appear.

The original answer’s four-row example was specific to a fixed layout. Its accompanying comment noted that four 72 mm items would not fit on a 297 mm page once text was included. This illustrates why counting nominal row heights without the rest of the page content can lead to the wrong break interval; it is not a general page-capacity formula for every document.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 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.

Test explicit breaks for a fixed row count

If each page is intended to contain a predictable number of rows, an explicit page boundary can be less ambiguous than letting wkhtmltopdf decide where a table should split. Choose one of the following strategies based on how your markup is organized. Do not apply both at once during the first test.

Separate each page into its own table

If every table represents one page and contains the intended four rows, try placing a break after each table:

<style>
  table.qr-page {
    page-break-after: always;
  }
</style>

<table class="qr-page">
  <tbody>
    <tr><td>QR item 1</td></tr>
    <tr><td>QR item 2</td></tr>
    <tr><td>QR item 3</td></tr>
    <tr><td>QR item 4</td></tr>
  </tbody>
</table>
<table class="qr-page">
  <tbody>
    <tr><td>QR item 5</td></tr>
    <tr><td>QR item 6</td></tr>
    <tr><td>QR item 7</td></tr>
    <tr><td>QR item 8</td></tr>
  </tbody>
</table>

This matches the reported workaround when each table holds four rows. Adapt the table class and row count to your own document. It is a poor fit if table lengths vary or if you need a single continuous table with automatic pagination.

Keep one table and mark a recurring row boundary

If all rows are in one table, the answer in the original report used a selector such as tr:nth-child(4n+5), together with page-break-inside: avoid and page-break-after: always. That selector is an example from one layout, not a universal “every four rows” rule. CSS counts child elements within their parent, and the correct target depends on whether rows are split between thead and tbody, whether there are other rows, and where your first intended boundary falls.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • 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.
<style>
  /* Example only: validate the matching rows in your actual markup. */
  table.qr-grid tr:nth-child(4n+5) {
    page-break-inside: avoid;
    page-break-after: always;
  }
</style>

Inspect which rows match before relying on the rule. If your first break should follow a different row, or a heading row changes the sequence, adjust the selector to the actual structure and verify each page in the output. If your layout instead needs a break after each group, separate page-sized tables may be easier to reason about.

For long or changing tables, inspect the markup and content

A recurring break can work for a fixed grid and still fail when the table is dynamic. Related wkhtmltopdf reports describe adjacent pagination symptoms: page-break declarations being ignored for large rows that span pages, and an empty row appearing after a repeated thead. These are troubleshooting clues, not evidence that the same mechanism causes every extra-space symptom.

  • Use explicit table sections. Check that column headings are in thead and data rows are in tbody. Confirm whether headings repeat and whether the selector targets the intended section.
  • Inspect unusually tall rows. A row containing long text, a large image or other expanding content may not fit where expected. A rule to avoid splitting a row cannot create more printable space on the page.
  • Check rowspans and nested tables. They change the effective table structure and can make a simple row-count assumption unreliable.
  • Look for overflow wrappers. Responsive containers or wrappers with scrolling and overflow rules may affect how content is laid out for printing.
  • Compare with and without repeated headings. If the gap or an empty row changes when a repeated header is involved, record that as a separate reproducible condition rather than assuming it is cell padding.

For dynamic tables, avoid hard-coding a row interval unless you can guarantee that rows retain a consistent height and count. Where you must preserve a particular grouping, test representative short and long content, including the cases most likely to wrap or enlarge a row.

Change one thing at a time and verify the PDF

Use a controlled loop rather than stacking several pagination rules and guessing which one helped:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • 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
  1. Generate a baseline PDF and note the affected page, the last row, the blank space and repeated-header placement.
  2. Make exactly one change: for example, add a break after each page-sized table, or test a row selector in the single-table version.
  3. Regenerate using the same wkhtmltopdf build and page settings.
  4. Compare the same page boundary and at least one later boundary. Confirm that rows remain together and that the fix did not merely move the gap or create a blank page.
  5. Repeat with content that changes row heights, then keep the smallest rule set that behaves acceptably for your actual documents.

A related issue report noted that moving a table by one pixel changed whether an empty row appeared after a repeated header. That shows sensitivity in that reported case; it does not prove that a one-pixel offset will fix extra space in your PDF. If small positional changes alter the result, record the finding and test more than one page boundary before treating the layout as stable.

Troubleshooting common outcomes

What you see What to check Next test
The gap moves to another page after adding page-break-inside: avoid. The rule may be changing where the content breaks without eliminating the page-fit constraint. Recheck usable page height and test an explicit boundary if the row count is fixed.
A row selector has no visible effect. Confirm which elements are siblings, whether the selector matches any rows, and whether header rows or separate table sections affect the sequence. Temporarily inspect the matched rows in a browser or test a simpler selector on a copy of the document; then regenerate the PDF.
The gap persists with explicit breaks. The fixed-row assumption may not match rendered content, or the workaround may not apply to this build or structure. A commenter on the original report also said the padding persisted. Check row heights, margins, headers, footers and content wrapping. Do not keep adding break rules without comparing output.
An empty row appears after a repeated header. Related reports connect this symptom with table pagination and repeat-header behavior, but do not establish a single fix. Test with the repeated header isolated and compare page boundaries under controlled settings.
A tall row splits or ignores a break rule. Related issue reports document page-break rules being ignored for rows spanning pages. Test with a smaller row or altered content to isolate the condition; do not assume a break rule guarantees row integrity.
The output changes after a tiny position adjustment. A related issue describes a one-pixel table movement changing an empty-row symptom. Record the exact change and inspect multiple boundaries; sensitivity is a warning to test, not a general fix.

These checks help narrow the problem but do not identify a guaranteed repair for every version or document. Keep a known-good baseline PDF and the precise rendering settings alongside any CSS workaround.

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

When to keep a workaround and when to reconsider wkhtmltopdf

wkhtmltopdf is an HTML-to-PDF converter built around WebKit/QtWebKit, and its project repository is archived. That status matters for maintenance planning: a template that depends on renderer-specific pagination behavior may require continuing tests and workarounds. It does not, by itself, explain your row gap or prove that another renderer will preserve your output.

If an explicit break reliably handles a stable, fixed grid, retaining that workaround may be reasonable. If content changes frequently, pagination rules remain brittle, or the output is sensitive to small layout shifts, evaluate whether continuing to depend on this rendering behavior is acceptable. Test any alternative with your real HTML, assets, page settings and edge-case content; the reports here do not establish which replacement will match a particular template.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 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 need is to capture a webpage as an image or PDF—not to repair an existing wkhtmltopdf HTML-to-PDF template—ScreenshotNeo offers a one-request screenshot API and an MCP server for AI agents. Its API can return a screenshot or PDF, but it is not a fix for wkhtmltopdf pagination in your own HTML template.

For a direct screenshot request, adapt the target URL in this cURL example. See the ScreenshotNeo API documentation for API details.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
  • Before capture, it accepts cookie/consent banners like a visitor and removes 60+ known consent platforms, newsletter popups and chat widgets; each step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing. Responses identify the page verdict and billing status in headers.
  • Its MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.
  • The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Every feature is on every plan.

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

Frequently Asked Questions

Does this issue only affect wkhtmltopdf 0.12.3?

The padding report cited here used 0.12.3 with patched Qt, while related pagination reports mention other 0.12.3 builds. Those reports do not establish that the symptom is limited to one version.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Will switching to another HTML-to-PDF renderer preserve my layout?

That depends on the template and renderer. Test the actual HTML, assets, page settings and edge-case content; the archived status of wkhtmltopdf is a maintenance consideration, not evidence that a replacement will render identically.

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.