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

Free Support Forum - aspose.com

HTML Pagebreak?

Is there any way to specify a pagebreak in a HTML document to be rendered as a PDF?

Hello Patrick,

Thanks for considering Aspose.

Can you please ellaborate your requirement, when you say "pagebreak in a HTML" do you mean pagebreak tag in string that contains HTML tags or you do you mean page break tag in HTML document.

Beside this if you use #$NP in HTML tags it will serve as pagebreakand adds a new page into Pdf document. Please correct me if I have not clearly understoof your requirement.

I wish to insert a tag in to the HTML document that when Aspose.pdf renders that tag, it forces a new page.

I am not clear what you mean by " you use #$NP in HTML tags it will serve as pagebreak". Can you give me a tag example?

Hello Patrick,

My apologies. Its is often to add text to the Pdf document, and if the text being added to the Pdf contains HTML Tags, than Aspose.pdf renders that text and its appearance in the Pdf document would be determined according to HTML Tag. When I said "you can use #$NP in the HTML Tag in any string containing HTML tags, that means when this string would be added to pdf document it would be rendered accordingly and new page will be added to the document".
Tag example is

string s = " This is a test for Page Break from here #$NP </ support in Text paragraph. ";

For information on working with text containing HTML Tags, kindly visit Working with Text Containing HTML Tags

Inserting page break into HTML is not supported well. HTML is not a page layout language. It's up to the browser to decide where and how to insert page breaks when the document is being printed. The CSS2 standard for stylesheets, allows you to specify pagebreak points for printing. But with Aspose.Pdf we have a limitation that CSS is not supported.

You may try

HELLO.



BYE.


HELLO.


it will inset page break before the Word BYE.

or

HELLO.



BYE.


HELLO.


it will inset page break after the Word BYE.