[RESOLVED]How to print a lengthy web form without page break using javascript

Hi, I just wrote some lengthy content using javscript window.open() and wrote contents with multiple lines, when i try to print using window.print() the document is set for printing but the issue is contents are broken at each page break say when the size
of the page ends the contents are printed to next page.

Here i dont use papers like a4 or something it is a continuous one, i dont know its name exactly but it is a rolling paper can print continuously without page break.

Please help me out to solve this issue. whithout any break in content i have to print the web page in my rolling paper.

Thanks in advance!

Hi Jeevanathan,

Thanks for your post.

We could avoid page break after (before or inside) the element as below.

//avoid page break after the element
document.getElementById("elementid").style.pageBreakAfter = "avoid";
//avoid page break before the element
document.getElementById("elementid").style.pageBreakBefore = "avoid";
//avoid page break inside the element
document.getElementById("elementid").style.pageBreakInside = "avoid";

For more information about pageBreakAfter , pageBreakBefore  and pageBreakInside Property, you could refer to the following links.

Hope it will be helpful to you.

Best Regards,

Fei Han

Leave a Reply