IronPDF How-Tos Page Breaks Add or Avoid Page Breaks in HTML PDFs Chaknith Bin Updated:July 28, 2025 IronPDF supports page breaks within PDF documents. One major difference between PDF documents and HTML is that HTML documents tend to scroll whereas PDFs are multi-paged and can be printed. Get started making PDFs with NuGet now: Install IronPDF with NuGet PM > Install-Package IronPdf Copy the code new IronPdf.ChromePdfRenderer().RenderHtmlAsPdf("<div>Page1 content</div><div style='page-break-after: always;'></div><div>Page2 content</div>").SaveAs("page-breaks.pdf"); Deploy to test on your live environment Start using IronPDF in your project today with a free trial Free 30 day Trial Get started with IronPDF Start using IronPDF in your project today with a free trial. First Step: Start for Free How to Use Page Breaks in HTML PDFs Download C# library to use page breaks in PDF Apply Page Breaks to HTML string and convert it to PDF Set avoid on page-break-inside attribute to avoid Page Breaks in Images Do the same thing for tables to avoid Page Breaks in Tables Set style at the CSS Level Add a Page Break To create a page-break in HTML you can use this in your HTML code: <div style="page-break-after: always;"></div> <div style="page-break-after: always;"></div> HTML Demonstration of Creating a Page Break In this example, I have the following table and image in my HTML, and I want them to be on two separate pages by adding a page break after the table. Table <table style="border: 1px solid #000000"> <tr> <th>Company</th> <th>Product</th> </tr> <tr> <td>Iron Software</td> <td>IronPDF</td> </tr> <tr> <td>Iron Software</td> <td>IronOCR</td> </tr> </table> <table style="border: 1px solid #000000"> <tr> <th>Company</th> <th>Product</th> </tr> <tr> <td>Iron Software</td> <td>IronPDF</td> </tr> <tr> <td>Iron Software</td> <td>IronOCR</td> </tr> </table> HTML Image <img src="/static-assets/pdf/how-to/html-to-pdf-page-breaks/ironpdf-logo-text-dotnet.svg" style="border:5px solid #000000; padding:3px; margin:5px" /> <img src="/static-assets/pdf/how-to/html-to-pdf-page-breaks/ironpdf-logo-text-dotnet.svg" style="border:5px solid #000000; padding:3px; margin:5px" /> HTML :path=/static-assets/pdf/content-code-examples/how-to/html-to-pdf-page-breaks-page-break.cs using IronPdf; const string html = @" <table style='border: 1px solid #000000'> <tr> <th>Company</th> <th>Product</th> </tr> <tr> <td>Iron Software</td> <td>IronPDF</td> </tr> <tr> <td>Iron Software</td> <td>IronOCR</td> </tr> </table> <div style='page-break-after: always;'> </div> <img src='https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg'>"; var renderer = new ChromePdfRenderer(); var pdf = renderer.RenderHtmlAsPdf(html); pdf.SaveAs("Page_Break.pdf"); Imports IronPdf Private Const html As String = " <table style='border: 1px solid #000000'> <tr> <th>Company</th> <th>Product</th> </tr> <tr> <td>Iron Software</td> <td>IronPDF</td> </tr> <tr> <td>Iron Software</td> <td>IronOCR</td> </tr> </table> <div style='page-break-after: always;'> </div> <img src='https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg'>" Private renderer = New ChromePdfRenderer() Private pdf = renderer.RenderHtmlAsPdf(html) pdf.SaveAs("Page_Break.pdf") $vbLabelText $csharpLabel And the code above will generate the PDF below, which has 2 pages: the Table on the First page and the Image on the second: Avoiding Page Breaks in Images To avoid a page-break within an image or table, you may use the CSS page-break-inside attribute applied to a wrapping DIV element. <div style="page-break-inside: avoid"> <img src="no-break-me.png" /> </div> <div style="page-break-inside: avoid"> <img src="no-break-me.png" /> </div> HTML Avoiding Page Breaks in Tables As shown above, page breaks within tables can be avoided by using the CSS page-break-inside: avoid. This is better applied to a wrapping DIV than to the table itself to ensure the style is applied to a block-level HTML node. To duplicate table headers and footers across every page of a large HTML table spanning multiple PDF pages, you may use a <thead> group within the table: <thead> <tr> <th>C Sharp</th><th>VB</th> </tr> </thead> <thead> <tr> <th>C Sharp</th><th>VB</th> </tr> </thead> HTML Advanced CSS3 Settings To give greater control, you may wish to use CSS3 in addition to your thead group: <style type="text/css"> table { page-break-inside:auto } tr { page-break-inside:avoid; page-break-after:auto } thead { display:table-header-group } tfoot { display:table-footer-group } </style> <style type="text/css"> table { page-break-inside:auto } tr { page-break-inside:avoid; page-break-after:auto } thead { display:table-header-group } tfoot { display:table-footer-group } </style> HTML Frequently Asked Questions How can I add a page break when converting HTML to PDF? To add a page break when converting HTML to PDF, you can insert a <div style='page-break-after: always;'></div> in your HTML code. This will ensure that the content following the div starts on a new page when using IronPDF. How do I prevent page breaks within an image in PDF conversion? To prevent page breaks within an image during PDF conversion, wrap the image in a <div style='page-break-inside: avoid'> using IronPDF. This CSS style ensures the image is not split across pages. What is the best way to avoid page breaks in HTML tables when generating PDFs? To avoid page breaks in HTML tables during PDF generation, apply the CSS page-break-inside: avoid to a wrapping <div> element. This ensures the table remains intact on the page when using IronPDF. How can I ensure table headers repeat on each page in a PDF? To ensure table headers repeat on each page of a PDF, use a <thead> element in your HTML table. This allows IronPDF to duplicate headers across multiple pages. What CSS settings can control page breaks in PDF documents? Advanced CSS settings for controlling page breaks in PDFs include using page-break-inside: auto for tables, page-break-inside: avoid; page-break-after: auto for rows, and setting display: table-header-group for <thead> and display: table-footer-group for <tfoot> when using IronPDF. How does HTML differ from PDF in terms of page layout? HTML documents generally scroll continuously, while PDFs are structured as multi-paged documents that require proper pagination. This is managed effectively using IronPDF. What library can help with adding page breaks in PDFs via C#? IronPDF is a C# library that can be utilized to manage page breaks when converting HTML to PDF. It offers various settings to handle page breaks efficiently. Chaknith Bin Chat with engineering team now Software Engineer Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience. Ready to Get Started? Free NuGet Download Total downloads: 15,080,714 View Licenses