Saturday, June 1, 2024
 Popular · Latest · Hot · Upcoming
37
rated 0 times [  41] [ 4]  / answers: 1 / hits: 137771  / 12 Years ago, mon, december 3, 2012, 12:00:00

Possible Duplicate:

Landscape printing from HTML






I am using below code to show print window on button click:



function print_onclick() {
window.print();
return false;
}


I want the page to be printed in Landscape format. Is there any property I can add in above code to make it work ?



Additional Info:
Since my page width is 1280 px, when I print it on A4 paper with portrait orientation, the font becomes too small.
I want to print only 2 lines. If not landscape, is there a way I can fix the font size of those table cell/divs while printing ?


More From » printing

 Answers
5

you cannot set this in javascript, you have to do this with html/css:



<style type=text/css media=print>
@page { size: landscape; }
</style>


EDIT: See this Question and the accepted answer for more information on browser support: Is @Page { size:landscape} obsolete?


[#81645] Saturday, December 1, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tonisandyp

Total Points: 694
Total Questions: 97
Total Answers: 77

Location: British Indian Ocean Territory
Member since Tue, Feb 22, 2022
2 Years ago
;