Support for page-break-inside: avoid;

Hi Aspose,

At the moment we do our line breaks with ‘page-break-before: always;’ Unfortunatly we do not always know how long the content is. We would like to avoid a page break within a certain div with the css prop: break-inside: avoid; It is in the css standard ( break-inside - CSS: Cascading Style Sheets | MDN ) but asopose does not react to this css prop.

var pdfDocument = new Document();

HtmlLoadOptions options = new HtmlLoadOptions();
var html = "<div style=\"border: 10px solid red; break-inside: avoid; height: 200px\">dont break me </div><div style=\"border: 10px solid red; break-inside: avoid; height: 200px\">dont break me </div><div style=\"border: 10px solid red; break-inside: avoid; height: 200px\">dont break me </div><div style=\"border: 10px solid red; break-inside: avoid; height: 200px\">dont break me </div><div style=\"border: 10px solid red; break-inside: avoid; height: 200px\">dont break me </div>";
            HtmlFragment textFragment = new HtmlFragment(html)
            {
                HtmlLoadOptions = options
            };

var page = pdfDocument.Pages.Add();
page.Paragraphs.Add(textFragment);
pdfDocument.Save("html_test.PDF");

Example while it breaks:

Full source code: GitHub - JoostVanVelthoven/AsposeAvoidElementBreak

Is their any workaround possible?

@JoostDelft

At the moment, the API only offers a property i.e. HtmlLoadOptions.IsRenderToSinglePage in order to generate single page PDF. We have logged an enhancement ticket as PDFNET-51824 in our issue tracking system for the support of CSS property that you mentioned. We will further look into the details of the ticket and let you know as soon as the ticket is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.

Do we have an expectation on when this will be completed? This is an issue that is very important to us as well.

And is there any workaround?

Thanks

@ANDREA.FARRIS

We are afraid that the ticket is not yet resolved. It is more like a new feature that needs to be added in the API. Its investigation is underway and regretfully, an ETA cannot be shared before analysis is done. However, we have recorded your concerns and will surely consider them during ticket investigation. We will surely inform you once we make some updates towards ticket resolution. Please spare us some time.

We are sorry for the inconvenience.