Saturday, July 9, 2016

using page break in print content

to print content with new page or putting a page break in the page we use css styling.
syntax: page-break-after: auto|always|avoid|left|right|initial|inherit;

Property Values

Value Description
auto(Default) Automatic page breaks
always Always insert a page break after the element
avoid Avoid page break after the element (if possible)
left Insert page breaks after the element so that the next page is formatted as a left page
right Insert page breaks after the element so that the next page is formatted as a right page
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

example:
@media print {
    .newPageClass{ page-break-after: always; }
}
and use this class in the div after which you want a page break while printing the page

No comments:

Post a Comment