To print the whole html page

user1260967 picture user1260967 · Mar 10, 2012 · Viewed 13.8k times · Source

I have a button and use window.print() to print the page ,

but it is printing only a singe page of what is visible in the viewport. However the page is long enough to fill 5 pages.

How can I get it to print the whole page?

Answer

nady gold picture nady gold · Sep 21, 2016

You need to create a separate css file for print whole page.

<link rel="stylesheet" href="css/print.css" type="text/css" media="print"/>

You can define following width in your css file.

body, html, #wrapper {
    width: 100%;
}