aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Automatic Printing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Automatic Printing" Watch "Automatic Printing" New topic
Author

Automatic Printing

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 819
Hi All,
I'm not exactly sure where I got this code since it's been such a long time ago but I'm having a problem with it. Before getting into the problem part could someone explain to me how the system knows what to do with OBJECT that gets inserted? I mean where the does the system look to for the object and how does it know what to do with it? I searched the registry and noticed a bunch of records with the ID below but not much in the record itself. Now the problem. I've used this code in one of my HTML pages to print a web page. The javascript with this code is in one frame (Frame A) while the page to be printed is in another frame (Frame B). Frame B holds the page to be printed and has a height of 1. This page is merely to hold certain pages on the screen and allow the user (from Frame A) to print them directly without the need for any dialog boxes (long story why this was done so I won't get into). This code works fine on Win2000, Win98, and "some" XP machines. On one particular XP machine this does not work. A problem regarding the security settings and something reffering to the ActiveX object not being found or not valid comes up (sorry I don't have the exact message but the error found was third person). If the settings are set at medium or high security then clicking the OK button on this pop-up error message does not do anything. If, however, the settings are low then the message still comes up but clicking OK does send the page to the printer. Can anyone tell me why and, if so, what solutions are out there to solve this problem? Thanks in advance for any help.

Rob

P.S. Below is the javascript code I've used.

<SCRIPT Language="Javascript">
function printit() {
if (NS) {
window.print() ;
} else {
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(6, 2); // Use a 1 vs. a 2 for a prompting dialog box
WebBrowser1.outerHTML = "";
}
}
</SCRIPT>
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Did you look to see if active-X is enabled on Interent Explorer on that machine. Sounds like one of the settings is not enabled.

Eric
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 819
Thanks for the reply Eric,
This is happening with one of our customers so I'll have to wait for a response until tomorrow. This customer is using the Low, Medium, and High settings in the security tab area of Tools so I assume this should be handled if in a low security setting? I'll check this out tommorow and, if still pending, get back to you. Thanks for the help again.

Rob
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 819
Hi again all,
The problem mentioned above does not appear to be directly related to the settings in the browser (i.e. security settings tab for Active X components). The problem is still the same as stated above and will not disappear even though all security settings have been set to accept or allow. Can anyone give a reasoning to why this is happening? Also, can someone give some feedback to the general questions I had regarding how the OBJECT tag worked, how it knows where to go, etc..,? I'd appreciate any help. Thanks again.

Rob
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 819
If no one can answer this question can someone point me to a site that might be able to help (either documentation or posting)? I'm not exactly sure whether this is a browser setting thing, client computer thing, or something else but I need this question answered as soon as possible. I'd would very much appreciate any response to this posting. Thanks.

Rob
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
http://www.meadroid.com/scriptx/freedep.asp

look at that..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Automatic Printing