We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to avoid page breaks inside tags in Aspose.pdf for .NET


Do you have a solution to avoid these kind of page breaks issue.PNG (51.8 KB)

Currently we are solving that kind of page breaks via CSS. (page-break-after: avoid;)

h1 {
font-size: 30px;
color: #1094C8;
white-space: nowrap;
font-weight: 700
page-break-after: avoid;

We want to handle it from the code. not only for the h1 tag but also each and every tag. Do you have any solution to avoid that kind of page breaks??? If so Could you please help me with the implementation?

HTML -HTML.zip (2.0 KB)


Could you please share some more detail about your requirement? What exact you want to achieve using Aspose.PDF APIs? Please also share your expected output PDF.


HTML- NewHTML .zip (2.1 KB)
PDF-637915372698161297-0.pdf (379.3 KB)

current output- Current_Output.PNG (24.1 KB)

expected outcome- Expected_Output.PNG (57.6 KB)

I want to avoid page breaks inside headings and list items by using Aspose.pdf.


We have logged your requirement in our issue tracking system as PDFNET-51983. We will implement this feature and inform you via this forum thread when it is available.

We apologize for your inconvenience.

1 Like

thank you very much