Reputation: 391
Assuming we have multiple html paragraph
<p>Paragraph 1</p>
<p>Paragraph 2</p>
Is there a way to print both to different page to the printer ?
Paragraph 1 would be printed on the first page and Paragraph 2 would be printed on the second page.
Thank You
Upvotes: 16
Views: 27624
Reputation: 27765
You can do this using CSS page-break-after
property:
@media print {
p { page-break-after: always; }
}
It will print each p
element on new page.
window.print()
@media print {
@page { margin: 0; }
p { page-break-after: always; }
}
<p>Paragraph 1</p>
<p>Paragraph 2</p>
Upvotes: 35