landscape printing

I just need to be able to have a button on
my web page that says "Print Landscape" and
have that page be sent to the default printer
using landscape mode.

Please help!


-----Lori
loriwang7310Asked:
Who is Participating?
 
weedCommented:
Youve got too many variables to ever get it to work in the real world.
0
 
weedCommented:
Cant do it. Each printer driver is different and is not controllable with javascript etc. Even if you could get it to work with printer X, it still wouldnt work for printer A-W. Not to mention that you'd have to do it for at least 3 different OSs.
0
 
loriwang7310Author Commented:
weed,

No, think not.  I am reading out on:

msdn.microsoft.com/library/en-us/dnie55/html/wb_print.asp?frame=true

that you can.  I just can't understand the directions.

I think they are saying that you can use an ActiveX control
and call it from a script to get access to the webbrowsers
print control, like this:

<HTML>
<HEAD>
<OBJECT ID="wbp" CLASSID="CLSID:778C58A9-81B6-11D3-BB8F-00C04FA3471C"></OBJECT>
<SCRIPT LANGUAGE="VBScript">
Sub Print()
If Len(wbp.DefaultPrinterName) = 0 Then
MsgBox "No default printer!"
Exit Sub
End If
MsgBox "Printing Landscape!"+wbp.DefaultPrinterName
wbp.Orientation = 2
wbp.Print
End Sub
</SCRIPT>
</HEAD>
<BODY>
<H3>This is a test</H3>
<INPUT TYPE="BUTTON" VALUE="Print" ONCLICK="Print()">
</BODY>
</HTML>


I have an ActiveX control pad but there is not webbrowser
print control object in the selection list.  I need to
know how to make an ActiveX web print control object.
Or I would even settle for a little page setup box that
would come up when the user clicked on the button.

Anybody out there know how to do this?

-----Lori


0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
weedCommented:
Youre assuming that everyone is using windows, which theyre not.
0
 
loriwang7310Author Commented:
Hey, weed,  I got something working!  I can
never figure out my problems until I ask the
experts-exchange.  I don't know what it is.

I found something called ScriptX and now
it is working:

<HTML>
<HEAD><TITLE>Landscape Printing Test</TITLE>
</HEAD>
<BODY BGCOLOR="9FCFCF" TEXT="000000" LINK="4E5CCC" VLINK="CC1A11">
<!-- MeadCo Security Manager -->
<object viewastext style="display:none"
  classid="clsid:5445be81-b796-11d2-b931-002018654e2e"
  codebase="smsx.cab#Version=6,0,0,421">
  <param name="GUID" value="{1FB3613D-2B04-11D4-A695-0000863B364E}">
  <param name="Path" value="sxlic.mlf">
  <param name="Revison" value="0">
</object>


<!-- MeadCo ScriptX -->
<object id=factory style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
     viewastext codebase="Scriptx.cab#Version=6,0,0,421">
</object>

<script defer>
function window.onload() {
  factory.printing.SetMarginMeasure(2) // margins in inches
  factory.printing.leftMargin = 1.0
  factory.printing.topMargin = 0.75
  factory.printing.rightMargin = 0.75
  factory.printing.bottomMargin = 0.75
  factory.printing.portrait = false

}
</script>
<h1> this is a test of landscape printing</h1>

<FORM>
<BR><INPUT TYPE="button" value="Print Landscape" onClick="factory.printing.Print(false)">

</FORM>
</BODY>
</HTML>

Of course, this probably won't work right on the
end-users machine because I don't know enough about
ActiveX.   They are probably gonna have to have
the ScriptX cab files on their PC?  Do you know?

----Lori
0
 
weedCommented:
Does it work for all browsers, all platforms, all printers, and all operating systems? Probably not. That's the catch. Certainly wont work on a Mac or *nix machine if youre using ActiveX.
0
 
loriwang7310Author Commented:
Yeah, the webserver that I'm using is a Sparc
and I'm going through an Oracle Application
Server.  I think I'm finding out it only works
off my PC not when I try to use it over the
webserver.  It keeps saying

Problem: Unauthorized site, or invalid security zone.

So, I'm stuck again and I'm leaving.  I've had it.
You wouldn't think just getting something to print landscape would be so complicated.

----Lori
0
 
loriwang7310Author Commented:
weed,

Well, it's working now.  I think I was
slap happy yesterday.  The end-user has
to execute this ScriptX.exe file on their
PC to put things into the registry.  

I'm awarding you the 100 points for
talking me down!

Thanks, bud.

----Lori
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.

All Courses

From novice to tech pro — start learning today.