473,396 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 19588
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Darcy Kahle | last post by:
I am trying to do some advanced printing in python using the win32ui module, and have run into an issue. I need to print a page landscape. As I could not determine how to specify the orientation...
4
by: Jody Gelowitz | last post by:
I am having a problem with printing selected pages. Actually, the problem isn't with printing selected pages as it is more to do with having blank pages print for those pages that have not been...
5
by: Patrick De Ridder | last post by:
How can I turn what I want to print 90 degrees using the logic below? Please tell me the code with which to make the modification. Many thanks, Patrick. using System.ComponentModel; using...
3
by: D Witherspoon | last post by:
No matter what I do the default paper size is always either A3 or 11 by 8.5 .. Here is the code. Dim dlg As DialogResult pd.DocumentName = "Weld Image" Dim pkPaperSize As New...
2
by: jc_va | last post by:
I need to print a document in landscape mode (using IE6). I see the @page directive, but I can't get it to work. I have searched this forum, but don't see many articles on printing landscape that...
2
by: Brad Pears | last post by:
I have a vb.net 2005 application and am using the print preview screen. This screen has a printer icon on it that the user can use to print the document currently being viewed. It uses the default...
3
by: Jlcarroll | last post by:
Hi, I am building a web page.and have a simple javascript menu... I call the javascript menu within a div block that my print sytlesheet has set as a display: none;, well all the content in that...
8
by: Mike P | last post by:
I am trying to use javascript to print my .NET page. I am building up some HTML using a stringbuilder and then using this javascript to try to print it : <input id="Button2" value="Print"...
7
by: Iain Wilson | last post by:
I am pulling my hair out trying to print various objects from a .net web page My apologies for cross posting but I need an answer and my previous post has attracted no interest. ASP.Net 2.0...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.