Solved

Telling the Browser to print landscape via Jscript

Posted on 2000-05-11
5
346 Views
Last Modified: 2012-05-04
Is there a way to tell the browser to print landscape via a Jscript function?
If so can I see some sample code.

 Thanks.
0
Comment
Question by:7of9121098
  • 3
  • 2
5 Comments
 
LVL 3

Expert Comment

by:bark10
ID: 2804434
The best you can do is have a Jscript call a print which pops up the usual print dialog box.  From there, you should be able to set the orientation.
0
 

Author Comment

by:7of9121098
ID: 2804607
Bark10 do you happen to have any sample code? Thanks....
0
 
LVL 3

Accepted Solution

by:
bark10 earned 50 total points
ID: 2804626
Call this function from whereever you want, ie. an image, a button, whatever.  [Usually using onClick("runPrint")]

<script>
function runPrint()
        {
        if (navigator.appName.indexOf('Microsoft') !=-1) parent.body.VBPrint()
        else if (window.print) parent.body.print();
        }
</script>


and just after the body tag place this...


   <object id=WBControl width=0 height=0
        classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2></object>
        <SCRIPT LANGUAGE=VBScript><!-- //
        Sub VBPrint() On Error Resume Next
        WBControl.ExecWB 6,1
        End Sub
        // --></SCRIPT>

Then whenever you click your item, it will bring up the print dialog.

Hope this helps.

Bark10
0
 
LVL 3

Expert Comment

by:bark10
ID: 2804633
Oops, the call is supposed to be, onClick("runPrint()").
0
 

Author Comment

by:7of9121098
ID: 2804641
Thanks...
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now