Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print in Landscape format [duplicate]

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 ?

like image 694
user1820973 Avatar asked Dec 03 '12 13:12

user1820973


People also ask

Why is my printer suddenly printing landscape?

The document or web page may be configured to prevent an image or table of data from spanning across multiple pages, forcing it to Portrait mode. If it's a document, you can reduce the size of the image or table to fit on a page printed in Landscape mode.

How do I change print format to landscape?

Click or tap in the document. Go to Layout > Orientation, and then select Landscape. Go to File > Print. Under Settings, make sure the orientation box says Landscape Orientation.

How do I copy from portrait to landscape?

Use different orientations in the same document Select the pages or paragraphs whose orientation you want to change. Click PAGE LAYOUT > Page Setup dialog box launcher. In the Page Setup box, under Orientation, click Portrait or Landscape. Click the Apply to box, and click Selected text.

How do I print 2 pages per sheet on landscape?

Show activity on this post. From the "Page Layout" ribbon, click on "Page Setup." It will open a dialog box to the "Margins" tab. Next to "Multiple pages," select "2 per page." If your page orientation is set to "portrait," the default option is to make two landscape pages, one on top of the other, on a portrait sheet.


1 Answers

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?

like image 59
hereandnow78 Avatar answered Oct 08 '22 08:10

hereandnow78