File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes ActiveX error in printpreview JS 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 "ActiveX error in printpreview JS" Watch "ActiveX error in printpreview JS" New topic
Author

ActiveX error in printpreview JS

PraveenKumar Kannankutty
Greenhorn

Joined: Aug 02, 2005
Posts: 13
HI,

Iam using the following piece of java script code, to implement the Print Preview functionality.

function printpr()
{
var OLECMDID = 7;
/* OLECMDID values:
* 6 - print
* 7 - print preview
* 1 - open window
* 4 - Save As
*/
var PROMPT = 1; // 2 DONTPROMPTUSER
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(OLECMDID, PROMPT);
WebBrowser1.outerHTML = "";
}

The code works fine if the same is executed from the local system, but an ActiveX error is displayed when the same is executed over the net.

Can anyone kindly help me in resolving this issue.

Thanks in Advance,
PK.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You have different settings for local and internet most likely.

Eric
PraveenKumar Kannankutty
Greenhorn

Joined: Aug 02, 2005
Posts: 13
You are right Eric, the problem is because of the Internet Security settings. But how do I overcome this.

Your valuable comments please...


Regards,
Praveen.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
there is nothing you can do. If you could change the setings from a web page it would defeat the security.

Eric
[ April 06, 2006: Message edited by: Eric Pascarello ]
PraveenKumar Kannankutty
Greenhorn

Joined: Aug 02, 2005
Posts: 13
But how does the Print Preview functionality implemented in the MENU Bar[In FILE] of IE works fine.

Is it because it is implemented in a different way, not by using the JS that I have mentioned in my earlier post?


Regards,
Praveen.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ActiveX error in printpreview JS