Solved

Telling the Browser to print landscape via Jscript

Posted on 2000-05-11
5
364 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

724 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