picasa
picasa

Reputation: 33

How to display print preview as same as the webpage using css?

I created a webpage which contains five rows in a table with header and footer.The table elongates if the characters exceeds in it,but fits in a single page.I have a 250 characters limitation for each in a row.When the rows contains some 100 characters,the five rows in a table elongates and fits in a page.But when I see print preview,table splits,and one-half of 3rd row displaying in first page and 2nd half and balance two rows displaying in next page.I use separate external css for main page and another external css for print preview.How to solve?.Please help.

Upvotes: 0

Views: 436

Answers (1)

Mr. Alien
Mr. Alien

Reputation: 157424

Short answer is you cannot trigger Print Preview because it's the local OS window, what you can do is before your user prints you can create a separate HTML document and use print specific stylesheet(which you are already using) for that file like this

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

And if you want to control page break yourself use this

@media print {
    whatever {
       page-break-after:always
    }
}

Upvotes: 2

Related Questions