How to Insert HTML Page Break with DocumentBuilder using .NET

I am trying to insert a page-break using builder with the following code:

builder.InsertHtml("<p style='page-break-after: always;'></p>")

However, the page break is not being recognized. Can a html page-break be added with builder?

I am creating an html string that contains all the formatting. I just need to be able to add a page break within the html string. Once the html string is created, I insert it using the builder insertHtml. The formatting looks good except for the page-break does work.

Thanks

@jlserpe

Please use the following code example to insert the page break using HTML. Hope this helps you.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Text before page break");
builder.InsertHtml("<br style=\"page-break-before:always; clear:both\" />");
builder.Writeln("Text after page break");
doc.Save(MyDir + "output.docx");

Thanks for the quick response! Your example code worked perfectly.

Thanks