469,362 Members | 2,441 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,362 developers. It's quick & easy.

Printing a page from ie in landscape when the browser has no menubar

Hi,

Just wondering if anyone can help here. We have a site where most of
the site opens in a window with no toolbars or menubar:
window.open('mypage.aspx','self','toolbar=0, menubar=0, etc, etc)
This is because it's a data driven site where space is at a premium and
we'd rather discourage use of back, stop and refresh.

The problem arises because some "view data" pages are designed to be
printed and have an onclick="window.print();" button, but the data
tables won't fit properly on portrait A4 (they are designed for
landscape) and there doesn't seem to be any way to default the page
setup to landscape from the html. It seems like an obvious thing to
have - surely the default page layout should be a property of the
document, not the software (as with a word processor).

Getting the user to change the page setup in the parent browser doesn't
help as the child window doesn't inherit the page setup. Some printer
setups will allow setting to landscape from a "properties" button in
the print dialogue, but that's printer specific. The page setup is the
obvious place to set the orientation.

Does anyone know of a way to do this? Obviously I'd prefer something
non-browser-specific, but all our users are on ie 5.0+ so anything for
ie would be better than nothing.

Thanks for any help anyone can offer.

Cheers,

Tim

Jul 24 '05 #1
6 19378
Having read the group's FAQs I'm not sure if this post is o\t or not.
I posted here as the issue seems to possibly include html, javascript,
CSS, ie - and I wasn't sure of another group that might cover all of
the above.

If this is an inappropriate post for this group I apologise, but would
appreciate pointing in the right direection.

Cheers again,

Tim

Jul 24 '05 #2
"Biguana" <te******@yahoo.co.uk> wrote:
Having read the group's FAQs I'm not sure if this post is o\t or not.
I posted here as the issue seems to possibly include html, javascript,
CSS, ie - and I wasn't sure of another group that might cover all of
the above.

If this is an inappropriate post for this group I apologise, but would
appreciate pointing in the right direection.


As you're talking about an IE specific setting (probably an intranet I
guess) then an IE orientated group would give you your best chance.
Probably something in the microsoft hierarchy.

I'm going to finish writing my response from a WWW perspective.

Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 24 '05 #3
"Biguana" <te******@yahoo.co.uk> wrote:
Just wondering if anyone can help here. We have a site where most of
the site opens in a window with no toolbars or menubar:
window.open('mypage.aspx','self','toolbar=0, menubar=0, etc, etc)
This is because it's a data driven site where space is at a premium and
Do the actual end users of the site appreciate this choice? Or would
they rather devote a little bit of space to the basic browser
functions that they can use on every other site? Oh well, an
increasing number of users are using browsers that don't let you
remove the toolbars anyway.
we'd rather discourage use of back, stop and refresh.
Then you should code your application so that it copes gracefully with
such things. You have to do that anyway as those functions are
available to the user via keyboard shortcuts, context menus, mouse
gestures, etc. as well as via the toolbar that you've managed to
remove (sometimes).
The problem arises because some "view data" pages are designed to be
printed and have an onclick="window.print();" button, but the data
tables won't fit properly on portrait A4 (they are designed for
landscape)
So you take away basic browser functions by using JavaScript to open a
new window, and then try to recreate them with more JavaScript only to
realise that you can't recreate them fully.

By the way what happens on your site for users who don't have
JavaScript enabled?
and there doesn't seem to be any way to default the page
setup to landscape from the html.
Nor should there be. HTML is designed for marking up data. It's about
what something is, not about how something is presented in one
particular medium.
It seems like an obvious thing to
have - surely the default page layout should be a property of the
document, not the software (as with a word processor).
But on the WWW you have no idea what printers are connected to your
users machines. Some may not have the ability to print in landscape
mode, some may use paper sizes large enough to fit the print out on a
portrait page, etc.,

CSS 2 had a property, size, that allowed you to suggest the
orientation of the printed page. It was dropped from CSS 2.1 due to
lack of support but something similar will be in CSS 3. None of which
is of any use to you as IE only supports a small amount of CSS.

The CSS 2.1 spec says:
"If a page box does not fit the target sheet dimensions, the user
agent may choose to:
Rotate the page box 90 if this will make the page box fit.
Scale the page to fit the target.
The user agent should consult the user before performing these
operations."

IE doesn't do that either. Some better browsers do to varying degrees
(e.g. I use Opera 8 and it can scale the print out to fit the page).
Getting the user to change the page setup in the parent browser doesn't
help as the child window doesn't inherit the page setup. Some printer
setups will allow setting to landscape from a "properties" button in
the print dialogue, but that's printer specific. The page setup is the
obvious place to set the orientation.
But you've taken the decision to remove access to the page setup
dialogue. You can't have it both ways.
Does anyone know of a way to do this? Obviously I'd prefer something
non-browser-specific, but all our users are on ie 5.0+ so anything for
ie would be better than nothing.


As a user I would overcome the problem as follows (assuming I was
forced to use IE rather than a browser that doesn't allow authors to
switch off access to basic functionality) -
1. Right click on the page and select Properties
2. Select the page URL and copy
3. CTRL+N to open a new browser window
4. Paste URL into the address bar and load page
5. Access Page Setup and Print the page normally.

As an author I see two possible options for you:

1. Review the decision to remove access to basic browser functions.

2. Look for an Active-X control that lets you change the IE page setup
options from with the web page.

Obviously (1) is cross browser whilst (2) is Windows IE only and
relies on your users being willing to take the security risk of
allowing Active-X controls to run.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 24 '05 #4
Steve,

Thanks for a thorough reply. As it happens you're right about the
intranet and unfortunately the decisions about attempting to limit
browser functionality aren't up to me. My first instinct would
certainly be to allow at least the menubar (if for no other reason than
it would solve my problem).

Apologies for not being clearer about the environment - it is
(unsurprisingly) a work based situation and (for the most part) rather
un-IT-literate users are using the site for data entry. Using the
site's functionality rather than the browser's should (ideally) assist
them, and most users seem to prefer explicit "now click here" type html
buttons than menu options they don't understand, don't use and don't
realise have gone until I point it out (believe me, I'd rather they had
a better understanding of it myself).

I think that "taking away" basic browser functions, and then "trying to
recreate them" could be described as attempting to "limit
functionality", and I'm also not sure I agree about the page layout not
being an appropriate property for the WWW. A word processed document
can also be opened on any PC with any printer, but the author may well
still have an intented page setup for it, where available. The fact
that variations on this theme have been\will be included in CSS
indicates that I may not be entirely alone.

On the subject of javascript, if it's not enabled you can't use the
site (just like if you don't have a computer you can't use the site).

I think what I've done here is explained it's an intranet site and then
responded to the WWW based reply. Oh well.

I may well post this in an ie group as suggested although I don't
imagine the replies will be any more thorough and helpful than your own
(meant sincerely, in case it sounds rude).

Thanks again,

Tim

Jul 24 '05 #5
On 13 Apr 2005 05:42:47 -0700, "Biguana" <te******@yahoo.co.uk> wrote:
I may well post this in an ie group as suggested although I don't
imagine the replies will be any more thorough and helpful than your own
(meant sincerely, in case it sounds rude).


The solution is ScriptX from http://www.meadroid.com/scriptx/

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 24 '05 #6
On 13 Apr 2005 02:22:16 -0700, "Biguana" <te******@yahoo.co.uk> wrote:
This is because it's a data driven site where [bogosity abounds] we'd rather discourage use of back, stop and refresh.
I'd rather encourage it. And as I'm the user who chooses whether I
should go there or not, my choice wins.

The page setup is the obvious place to set the orientation.


You should begin by looking at print-specific CSS. There's an awful
lot you can do with this, such as supressing nav menus on the printed
version. It even works on almost all browsers.

There's useful CSS stuff you can do to control page breaking, which
barely works anywhere. Shame (you should probably still try though)

If you want to control print orientation or margins, then you're a bit
stuck. For an IE/ActiveX world you can do this quite neatly with this:
http://www.meadroid.com/scriptx/
Obviously this is less portable than you'd like, but you can code in
such a way that it doesn't _hurt_ anything that can't use it.

Jul 24 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Darcy Kahle | last post: by
4 posts views Thread by Jody Gelowitz | last post: by
5 posts views Thread by Patrick De Ridder | last post: by
3 posts views Thread by D Witherspoon | last post: by
2 posts views Thread by jc_va | last post: by
2 posts views Thread by Brad Pears | last post: by
3 posts views Thread by Jlcarroll | last post: by
8 posts views Thread by Mike P | last post: by
7 posts views Thread by Iain Wilson | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.