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. Ensure proper HTML page breaks in your PDF in one line! new IronPdf.ChromePdfRenderer().RenderHtmlAsPdf("<div>Page1 content</div><div style='page-break-after: always;'></div><div>Page2 content</div>").SaveAs("page-breaks.pdf"); Install with NuGet PM > Install-Package IronPdf 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 in an HTML document? To add a page break in an HTML document, you can use the CSS style 'page-break-after: always;' within a element in your HTML code using IronPDF. How to avoid page breaks in images when converting HTML to PDF? To avoid page breaks in images, apply the CSS attribute 'page-break-inside: avoid' to a wrapping element around the image using IronPDF. Can I prevent page breaks within tables? Yes, you can prevent page breaks within tables by using the CSS 'page-break-inside: avoid' on a wrapping element. This ensures that the table is treated as a block-level element in IronPDF. How can I ensure table headers are repeated on each page in a PDF? To ensure table headers repeat on each page, use a group in your HTML table structure. This allows headers to be duplicated across multiple pages when using IronPDF. What are some advanced CSS settings for controlling page breaks in PDFs? Advanced CSS settings 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 and 'display: table-footer-group' for in IronPDF. What is the main difference between HTML documents and PDFs regarding page layout? The main difference is that HTML documents tend to scroll continuously, while PDFs are multi-paged and can be printed, requiring proper pagination. This is managed using IronPDF. Is there a C# library available for adding page breaks in PDFs? Yes, the IronPDF C# library can be used to manage page breaks when converting HTML to PDF. It supports various settings for handling page breaks effectively. 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: 14,631,247 View Licenses Get your FREE 30-day Trial Key instantly. 15-day Trial Key instantly. The trial form was submitted successfully. Your trial key should be in the email.If it is not, please contactsupport@ironsoftware.com No credit card or account creation required Test in productionwithout watermarks 30 days fullyfunctional product 24/5 technicalsupport during trial Try IronPDF for Free Get Set Up in 5 Minutes Install with NuGet Version: 2025.8 Install-Package IronPdf nuget.org/packages/IronPdf/ In Solution Explorer, right-click References, Manage NuGet Packages Select Browse and search "IronPdf" Select the package and install Download DLL Version: 2025.8 Download Now or download Windows Installer here. Download and unzip IronPDF to a location such as ~/Libs within your Solution directory In Visual Studio Solution Explorer, right click References. Select Browse, "IronPdf.dll" Licenses from $749 15 1000 1 Now you've installed with Nuget Your browser is now downloading IronPDF Next step: Start free 30-day Trial No credit card required Test in a live environmentFully-functional product24/5 technical support Get your free 30-day Trial Key instantly. Thank you.If you'd like to speak to our licensing team: The trial form was submittedsuccessfully.Your trial key should be in the email.If it is not, please contactsupport@ironsoftware.com Schedule a call Have a question? Get in touch with our development team. No credit card or account creation required 15 1000 1 Now you've installed with Nuget Your browser is now downloading IronPDF Next step: Start free 30-day Trial No credit card required Test in a live environmentFully-functional product24/5 technical support Thank you. View your license options: Thank you.If you'd like to speak to our licensing team: View Licensing Schedule a call Have a question? Get in touch with our development team. Have a question? Get in touch with our development team. Get started for FREE No credit card required Test in a live environment Test in production without watermarks.Works wherever you need it to. Fully-functional product Get 30 days of fully functional product.Have it up and running in minutes. 24/5 technical support Full access to our support engineering team during your product trial Get your free 30-day Trial Key instantly. No credit card or account creation required The trial form was submittedsuccessfully. Your trial key should be in the email.If it is not, please contactsupport@ironsoftware.com Trusted by Millions of Engineers Worldwide Get started for FREE No credit card required Test in a live environment Test in production without watermarks.Works wherever you need it to. Fully-functional product Get 30 days of fully functional product.Have it up and running in minutes. 24/5 technical support Full access to our support engineering team during your product trial Get your free 30-day Trial Key instantly. Install with NuGet View Licensing Licenses from $749. Have a question? Get in touch. Trusted by Millions of Engineers Worldwide Book Free Live Demo Book a 30-minute, personal demo. No contract, no card details, no commitments. Here's what to expect: A live demo of our product and its key featuresGet project specific feature recommendationsAll your questions are answered to make sure you have all the information you need.(No commitment whatsoever.) CHOOSE TIME YOUR INFO Book your free Live Demo Trusted by Over 2 Million Engineers Worldwide Legal Information Copyright © Iron Software 2013-2025 Terms Privacy Cookie