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

Free Support Forum - aspose.com

Generate pdf via html or HtmlFragment with rule to not place on end of page

Hi.

We are trying to generate official law documents via aspose pdf and we came across rly huge problem.
For input we get even 30MB+ json of law and we process each fragment of law as html that we can put HtmlFragment tf = new HtmlFragment(paraHtml);
and then
pdf.Pages.Last().Paragraphs.Add(tf);
so even small laws can have 15000 of them, via this 657 page long law takes 6-7 mins to generate, if we do this just via one big html, via that it takes 1-2 mins.
Now to that very big problem. some fragments of law can not be at end of page. Is there any way how to tell that fragment via HtmlFragment or somehow via css or html elements that it can be in middle of page, start of page, but not in lower 30% of page?

Only way we manage to find how to do it, is to check on position of last thing on last page via ParagraphAbsorber or TextFragmentAbsorber, add one HtmlFragment call ProcessParagraphs.
and do this again for each law fragment. But via this method it takes around 15hours to generate and this is not acceptable for us. 15 hours for just 657 page law, we even have 6k+ pages and time complexity is exponential for ProcessParagraphs in loop.

@mvesely

Can you please share a sample application, source file and generated PDF. We will be able to investigate that on our end on provision of requested information.