Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is there a JavaScript Function to print Landscape?

2,284 views
Skip to first unread message

Stocker

unread,
Oct 24, 2000, 3:00:00 AM10/24/00
to
I need to print a form that runs wide to the right of the portrait page
setup limitations. The function below only prints out in portrait. Is there
a function that allows this to go landscape?
<a href="javascript:window.print();"><img border="0" src="../print.gif">
Print Report</p>


Peter Shore

unread,
Oct 25, 2000, 3:00:00 AM10/25/00
to

"Stocker" <stoc...@flashcom.net> wrote in message news:svc8b4i...@corp.supernews.com...

I don't think that there's a method of controlling this from a Web page,
though somebody else may know otherwise. I suspect there's a
security issue with this.

However, in IE you can use the onbeforeprint event, in conjunction with an
XML templateprinter element to ascertain current printer settings.

Then, if (pageHeight>pageWidth), you know you don't have landscape
settings, and can prompt the client to re-set for landscape, then open
up a printer control dialogue box for him/her.

You can also use a separate stylesheet (media="print") to prevent printing
until the printer is set for landscape. Toggle the body display property to
enable/prevent printing. Or if IE5.5, set the zoom property to shrink width
to a size small enough to fit within print margins (which you can also query)
if a printer is set for portrait. Alternatively, set up layout in a printer stylesheet
to print okay in portrait in the first place. Layout for the printer needn't look
anything like screen layout.

Refer:

http://msdn.microsoft.com/workshop/browser/hosting/printpreview/reference/behaviors/TemplatePrinter.asp

- Peter

Jim Ley

unread,
Oct 25, 2000, 3:00:00 AM10/25/00
to
On Wed, 25 Oct 2000 14:46:59 GMT, "Peter Shore" <pete...@home.com>
wrote:

In IE you can also use ScriptX from http://www.meadroid.com/scriptx/
which will give you access to all sorts of printing features with
their activeX.

Jim.


--
FAQ: http://jibbering.com/faq/
Old FAQs: http://jibbering.com/faq/old/

Kien

unread,
Oct 26, 2000, 7:26:33 AM10/26/00
to
I don't think so.
The window.print() command oftens brings up the print dialog box asking
the user to choose landscape/portrait anyway, doesn't it?

--

Kien
www.caoxuan.com

If you value your visitors,
don't mess around with their browsers.

0 new messages