Discussion Locked

how to print html in landscape?

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi,

Is anybody know how to program in html or javascript. When a button is clicked, a page is printed in landscape.

Thank you,
Nhan Nguyen

3 replies

by jay eckles

I assume you're talking about printing from a browser. If that is the case, then you've got a problem. Neither Javascript nor VBScript have access to the print controls on any platform. The only thing you can do is call up the user's print dialogusing window.print(). It is up to the user to select things like which frame to print, what orientation, etc. You cannot programmatically set these options for the user.

The only solution would be a standalone application, like a Java or VB application that can access the programming interface. So perhaps if you wrote your own browser (which is not difficult using the controls provided by Java or VB), you might be able to add on a little bit of script interpretation that would provide access to the printing interface. Obviously it wouldn't be standard and wouldn't work in any browser but yours, but you don't have much choice here.

You don't have to take my word on it; for information about Javascript and all of its objects and methods, go to
http://developer.netscape.com/docs/manuals/js/client/jsref/index.htm
and for information about VBScript and the objects it has access to within IE, go to
http://msdn.microsoft.com/library/default.asp?url=/workshop/entry.asp

(don'tforget to remove spaces from URLs)

Good luck.

Jay Eckles

This discussion is closed to new replies.