I am facing page break issue with aspose. I am converting an html string into aspose pdf.
But page break not happens. I am able to generate pdf without page break.
I have attached my sample code.
For each table starts with “Main Heading”, i want to display in different page.
Means, the row with “Main Heading”, should break into next page instead of displaying in the same as continuation of the first one.
Sample.zip includes both html and the pdf , i generated.
Also i have attached the code.zip.
I added the below code in html for page break., but failed to break:
Added for Pagebreak.
Please help me on this as early as possible.
Thanks for your inquiry. Your HTML document contains the nested tables. There is one main table that contains the tables inside TD tag. Please remove the upper most tables to get the desired output in PDF. We have attached the modified HTML document with this post for your kind reference.
Thank you for the quick response.
But the issue is not resolved. the mentioned solution doesn’t works for more data.
I have attached sample htmls and resulted pdf. If more Page breaks needed, it fails.
I removed all inner and outer tables, and just used a single table . still that also not working.
Please help me with your valuable suggestions.
Thanks for your inquiry.
FirstCell.FirstParagraph.ParagraphFormat.PageBreakBefore property as shown below to achieve your requirements. We have attached the output PDF with this post for your kind reference. Hope this helps you. Please let us know if you have any more queries.
Document doc = new Document(MyDir + "input_modified.html");
foreach (Section section in doc.Sections)
for (int i = 1; i < section.Body.Tables.Count; i++)
Table table = section.Body.Tables[i];
table.FirstRow.FirstCell.FirstParagraph.ParagraphFormat.PageBreakBefore = true;
doc.Save(MyDir + "Output.pdf");
Can you provide the input_modified.html, which you passed? I am failing to break it. If i know the html format, i will try to generate html string in the same format
Thanks for your inquiry. I used the same HTML shared in htmls.zip. I have attached it with this post for your kind reference.