Jump to content

force a web page to print in landscape


j4ymf

Recommended Posts

hello all

 

i was wondering if anyone new of any code that could help me force a page to print in landscape format,

 

what i mean is i have some tables on my webpage and when i press print, it prints in portrait.

 

is there any code that i can put in to tell the printer to print landscape?

 

many thanks jason

Link to comment
Share on other sites

Short answer, no. Long answer is that it is possible, but only in IE and they have to use a button you put on the page.... and it relies on ActiveX.

 

http://www.meadroid.com/scriptx/intro62.asp

 

I rely on the free version where I work and I can force everyone to use IE to print reports. It works great. I wouldn't push this off to the general public however, since it requires them to accept a software install and use your print buttons.

 

I'd suggest either using PDF or trashing the idea altogether.

Link to comment
Share on other sites

ALWAYS visit the www.w3schools.org before saying something is not possible on CSS. There are a subset of CSS that applies to printing documents, and yes u can through css print a document on landscape. w3schools

 

Short answer, no.  Long answer is that it is possible, but only in IE and they have to use a button you put on the page.... and it relies on ActiveX.

 

http://www.meadroid.com/scriptx/intro62.asp

 

I rely on the free version where I work and I can force everyone to use IE to print reports.  It works great.  I wouldn't push this off to the general public however, since it requires them to accept a software install and use your print buttons.

 

I'd suggest either using PDF or trashing the idea altogether.

236422[/snapback]

Link to comment
Share on other sites

Ooohh... lookie, a CSS2 attribute. How about we talk about something that works well AND degrades well, huh?

 

ALWAYS consider the user when pointing someone to a relatively recent addition to the standard.

 

EDIT: Might I also add that it will not force your printer to print in a landscape mode. You cannot control the user's printer settings through CSS.

 

ALWAYS double check the desires of the OP and the functionality of your supposed answers before posting your arrogant [removed].

 

edited by czambran: Removed crude language

Link to comment
Share on other sites

First of all the CSS Print Properties are supported by most browsers except IE(like so many other properties).

 

You should try it, it will actually print a page on either landscape or portrait. I think the user can override this by going to page setup, and please stop using crude language. We are suppose to be intelligent people, who can have an argument without insulting each other. The previous post is the second post of the DAY I had to edit.

Link to comment
Share on other sites

I did try it. I tried it on 2 major browsers (IE and Opera, both the latest releases), and guess what? It didn't do anything.

 

And if you're seriously going to sit there and say that someone should use code that doesn't work in IE, I'm going to sit here and laugh at you. You and I might know better, but half the world still uses IE.

Link to comment
Share on other sites

<body>
<DIV>
Hello world
</DIV>

<DIV style="width: 800px; border: 1pt solid red; size: landscape; page-break-before: always">
Should be landscape
</DIV>

<DIV style="size: portrait; page-break-before: always">
Hello again, world
</DIV>

</body>

 

I agree with Ober.

 

I tried the above with IE6 and it doesn't work. It just truncates the wide div and doesn't even print the missing bit on a new page.

 

It's a fact of life that there is a lot of IE out there. IF you are working on a corporate intranet and can impose a more compliant browser on the user population then fine, use the CSS. Otherwise take careful note of which bits of CSS are usable with IE (eg page breaks work ok)

Link to comment
Share on other sites

  • 11 months later...

hello I felt compelled to answer this even though it is really quite old, as I was looking for the same thing, and also did a few years ago.

 

check this link

 

[a href=\"http://web.tampabay.rr.com/bmerkey/examples/landscape-test.html\" target=\"_blank\"]http://web.tampabay.rr.com/bmerkey/example...scape-test.html[/a]

 

 

just in case people are still looking for the answers ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.