HTML To PDF Converter
10 September 2025

CSS Page Breaks for HTML to PDF: Clean Multi-Page Reports & Invoices

Stop awkward splits in the middle of headings and tables. Practical CSS techniques to control page breaks when converting HTML to PDF for professional, readable multi-page documents.

When you convert HTML to PDF, the most common formatting issue is ugly pagination: headings orphaned from their content, tables split randomly, and sections starting halfway down a page. The fix is usually a simple set of CSS page break rules.

Use these techniques for invoices, statements, and multi-page reports—and test your output with realistic data. If you need a quick export, try our HTML to PDF converter.

Modern vs legacy page-break CSS

You’ll see both legacy properties (page-break-before, page-break-after) and modern ones (break-before, break-after, break-inside). Many PDF renderers support both.

  • Use modern: break-before, break-after, break-inside
  • Fallback: include legacy equivalents where needed

Practical patterns that work

1) Force a new page for a section

Great for “Terms & Conditions”, “Appendix”, or a new report chapter.

/* Start each .pdf-section on a new page */
.pdf-section {
  break-before: page;
  page-break-before: always; /* legacy fallback */
}

2) Prevent headings from being separated from content

Keeps a heading with its first paragraph or block.

h2, h3 {
  break-after: avoid;
  page-break-after: avoid; /* legacy fallback */
}

3) Avoid splitting important blocks and cards

Use for summary boxes, totals panels, or signature sections.

.no-break {
  break-inside: avoid;
  page-break-inside: avoid; /* legacy fallback */
}

4) Tables: keep rows intact and repeat headers (when supported)

Tables are tricky. A good baseline is to prevent row splitting and ensure table headers are clearly styled.

tr, td, th {
  break-inside: avoid;
  page-break-inside: avoid;
}

Checklist for multi-page PDFs

  1. Use a print stylesheet with @media print.
  2. Set consistent margins and page size (A4/Letter).
  3. Add break-inside: avoid to cards and summary sections.
  4. Protect headings: avoid leaving them as the last line of a page.
  5. Test “worst case” content (long names, big tables, many rows).

Export a clean PDF

Once page breaks are under control, your documents instantly look more professional. Generate your next invoice or report at htmltopdfconverter.com.au.

FAQ

Which CSS property is best for HTML to PDF page breaks?

Prefer break-before/break-after/break-inside, and add legacy page-break-* properties as a fallback if you need broader compatibility.

How do I stop a table row splitting across pages?

Apply break-inside: avoid (and legacy page-break-inside: avoid) to table rows and cells, then test with large tables to confirm the renderer respects it.