Jump to content


Photo

force a web page to print in landscape


  • Please log in to reply
8 replies to this topic

#1 j4ymf

j4ymf
  • Members
  • PipPip
  • Member
  • 26 posts
  • Locationleicestershire, england

Posted 21 May 2005 - 01:51 AM

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

#2 Volte

Volte
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 22 May 2005 - 05:03 PM

http://www.experts-e...Q_20972638.html

Hope that helps, seems pretty impossible.
UNIX ALL THE WAY BABY!

#3 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 23 May 2005 - 06:10 PM

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....ptx/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.

Info: PHP Manual


#4 czambran

czambran
  • Staff Alumni
  • Advanced Member
  • 52 posts
  • LocationFairfield,IA

Posted 23 May 2005 - 07:03 PM

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....ptx/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.

View Post


Chris
Using undefined variables in PHP is not an error, just sloppy coding practice. PHP5 Power Programming BOOK
--------------------------------------------------------------------------
PHP F.A.Q.
Linux User #394154

#5 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 23 May 2005 - 07:40 PM

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

Info: PHP Manual


#6 czambran

czambran
  • Staff Alumni
  • Advanced Member
  • 52 posts
  • LocationFairfield,IA

Posted 23 May 2005 - 08:30 PM

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.
Chris
Using undefined variables in PHP is not an error, just sloppy coding practice. PHP5 Power Programming BOOK
--------------------------------------------------------------------------
PHP F.A.Q.
Linux User #394154

#7 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 23 May 2005 - 10:16 PM

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.

Info: PHP Manual


#8 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,020 posts

Posted 24 May 2005 - 08:41 AM

<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)
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#9 clartsonly

clartsonly
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 24 April 2006 - 03:29 PM

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 ;)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users