Solved

Telling the Browser to print landscape via Jscript

Posted on 2000-05-11
5
362 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

739 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