Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 371
  • Last Modified:

Telling the Browser to print landscape via Jscript

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
7of9121098
Asked:
7of9121098
  • 3
  • 2
1 Solution
 
bark10Commented:
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
 
7of9121098Author Commented:
Bark10 do you happen to have any sample code? Thanks....
0
 
bark10Commented:
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
 
bark10Commented:
Oops, the call is supposed to be, onClick("runPrint()").
0
 
7of9121098Author Commented:
Thanks...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now