Prevent Page Breaks in PDF Table Rows

If you have table rows that span multiple lines, by default, the PDF generator won't make any effort to keep those multi-line rows on the same page if they fall on a page break. This is most evident when you have table row headers:

Default table row behavior: page breaks can happen in the middle of tall row

You can add some Custom CSS to prevent this mid-row page break and force page breaks to occur between table rows:

  1. Go to Settings > Style.
  2. Copy the code below and paste it anywhere into the Custom CSS section below the preview pane.
    /* Force PDF page breaks between rows, not mid-row */
    .hg-pdf table tr {
      page-break-inside: avoid;
    Your code should look like this:
  3. Save.

Once you re-save the article, your PDF should now break properly between the rows:

The PDF page break now happens between rows, rather than mid-row.

As with all PDF style settings, by default this style change will only be applied to existing articles once they are resaved. Contact us to have all of your existing article PDFs regenerated with the new style.

To choose where to insert page breaks in an article, check out our Snippet to Force Page Breaks in PDFs.