Hello Everyone,

I am struggling to print a page in landscape. The reason behind to print in landscape was that, the table has many coulmns or anything else can be done besides printing in landscape?. Is there any statement in html to server the option of fit in page in printer settings automatically?

Even the print function is not producing total satisfactory output...
I am calling window.print on the onload event of the target page and then closing it. But it is opening then giving me an option to select the printer then closes automatically. But is it possible to print an other page without opening--> printing-->closing. I mean printer options to print an other page on click of a button.

Please help me to solve this issue! or suggest me an alternative method .

Recommended Answers

All 3 Replies

Had the same problem a while ago. Not easy to solve, but there are some things you can do.

@page land {size: landscape;}

works in Firefox.

1. div.page {
   2. writing-mode: tb-rl;
   3. height: 100%;
   4. width:100%;
   5. margin: 10% 0%;
   6. filter: progid:DXImageTransform.Microsoft.BasicImage(Rotation=1);
   7. }

works in IE but ...... well try it and you see what I mean. It doesn't look pretty.

The solutions I used:

  • create a new "print" page showing the output for the printer and an alert window pops up telling the user to set the printer to landscape.
  • create a pdf file using dompdf. Then you can set the page orientation to landscape and after you created the pdf open it in a new window.

The second solution has the advantage that it is a pdf and therefore printer independent, but the drawback is that the user must have a pdf viewer/add-on installed.

control of the local hardware is the users not yours
I have 5 printers attached to this, one is a steel cutting water jet, one prints self adhesive labels to go on the gut steel, one has paper in it
even page layout is finally the users
you can style the page with @media css rules @media print { body { line-height:100%; font-size:10.5pt; font-family:verdana, arial, sans-serif; } but have no idea what paper is in the printer

I am on vacation so not able to give reply immediately..Thanku very much for the quick response:-)I tried method 1 and experienced the same results as u said..

Had the same problem a while ago. Not easy to solve, but there are some things you can do.

@page land {size: landscape;}

works in Firefox.

1. div.page {
   2. writing-mode: tb-rl;
   3. height: 100%;
   4. width:100%;
   5. margin: 10% 0%;
   6. filter: progid:DXImageTransform.Microsoft.BasicImage(Rotation=1);
   7. }

works in IE but ...... well try it and you see what I mean. It doesn't look pretty.

The solutions I used:

  • create a new "print" page showing the output for the printer and an alert window pops up telling the user to set the printer to landscape.
  • create a pdf file using dompdf. Then you can set the page orientation to landscape and after you created the pdf open it in a new window.

The second solution has the advantage that it is a pdf and therefore printer independent, but the drawback is that the user must have a pdf viewer/add-on installed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.