openhtmltopdf c# - page breaks not working and not creating new page in the PDF file

1.5k Views Asked by At

I am using OpenHtmltoPDF and its generating PDF files

The problem that I have is, it is not creating new pages

I tried including the below html, but they didn't work

<div style = 'display:block; clear:both; page-break-after:always;'></div>

<div style='display:block;page-break-before:always;'></div>

The same code however creates new page in this sandbox site they have

https://sandbox.openhtmltopdf.com/

2

There are 2 best solutions below

0
On

try to use the same code . You need create "div" before your page break, I think this is your solution.

0
On

I think you confused two rendering utilities. The library that you use is OpenHtmlToPdf (created by vilppu for .NET), whereas the sandbox page is created for OpenHtmlToPdf (created by danfickle for Java).

I don't know if .NET library supports page-break-after etc, but I know the Java one does.