Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print html to multiple page

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

like image 386
ConfusedUser Avatar asked Jan 13 '15 18:01

ConfusedUser


People also ask

How do I print multiple HTML files at once?

Download or collect the web pages at a location so that you can print them easily. Step 1 – Click Add local Html file (s) and select one or more correct file and click Open. Step 2 – Select Print all and all the web pages will be printed one after another.

How do I print 4 pages per sheet?

Print multiple pages on a sheetClick File > Print. Under Settings, click One page per sheet, and then choose Multiple pages per sheet in the list. Click Print.


1 Answers

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>
like image 105
antyrat Avatar answered Oct 21 '22 12:10

antyrat