'page-break-before:always' inserts section break instead of page break using .NET | HTML to PDF conversion

Hi,

I am using ckeditor as my editor. In that I have an option for page break. When I added page break in paragraph and generate word document with ckeditor html, document will have session break with next page instead of page break. I am attaching my input and output document with sample code.

sessionbreakIssue.zip (176.2 KB)

You can see because of the session break my header and footer is not coming in the first page. Please check the issue.

Thank you

@Gptrnt

You can force a Page Break in Word document by using the HTML like below:

<br style="page-break-before:always; clear:both" />

Please use following HTML in the code to get the desired output.

String htmlString = "<p style=\"text-align:justify\"><span style=\"background-color:rgb(255, 255, 255); color:rgb(0, 25, 55); font-family:arial,helvetica,sans-serif; font-size:14px\">Topic sentences are similar to&nbsp;</span><strong>mini thesis statements</strong><span style=\"background-color:rgb(255, 255, 255); color:rgb(0, 25, 55); font-family:arial,helvetica,sans-serif; font-size:14px\">. Like a thesis statement, a topic sentence has a specific main point. Whereas the thesis is the main point of the essay, the topic sentence is the main point of the paragraph. </span></p>\n" +
        "\n" +
        "<br style=\"page-break-before:always; clear:both\" /><div <span style=\"display:none\">&nbsp;</span></div>\n" +
        "\n" +
        "<p style=\"text-align:justify\"><span style=\"background-color:rgb(255, 255, 255); color:rgb(0, 25, 55); font-family:arial,helvetica,sans-serif; font-size:14px\">Like the thesis statement, a topic sentence has a unifying function. But a thesis statement or topic sentence alone doesn&rsquo;t guarantee unity. An essay is unified if all the paragraphs relate to the thesis, whereas a paragraph is unified if all the sentences relate to the topic sentence.&nbsp;</span><strong>Note:</strong><span style=\"background-color:rgb(255, 255, 255); color:rgb(0, 25, 55); font-family:arial,helvetica,sans-serif; font-size:14px\">&nbsp;Not all paragraphs need topic sentences. In particular, opening and closing paragraphs, which serve different functions from body paragraphs, generally don&rsquo;t have topic sentences.</span></p>\n" +
        "";