How to pass a COM/ActiveX object to JavaScript?

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

How to pass a COM/ActiveX object to JavaScript?

Post by DSSavant »

I bet you have not been asked how to pass an ActiveX/COM object into the executing JavaScript engine yet. Using a normal scripting host control in C/C++/C# it is a very easy thing to inject a COM object into the script's execution state. Say something like a Logging routine or something useful for debugging. Is there a way with RunJavaScript(...) or DoVerb(...) to do this? Maybe something funky like passing it in a SAFEARRAY?
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: How to pass a COM/ActiveX object to JavaScript?

Post by Corwin - Tracker Sup »

Hello,

No, I'm afraid that this is not possible to do such thing with our AX control.
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: How to pass a COM/ActiveX object to JavaScript?

Post by DSSavant »

Didn't think so ;)

I noticed that I am also Not able to instantiate COM objects from within your JavaScript implementation. Is this by design or just poor programming on my part:

var xmlDOM = new ActiveXObject("msxml2.DOMDocument");

This fails from within the FullDemo demo application. Outside of your product, it works like a dream.
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: How to pass a COM/ActiveX object to JavaScript?

Post by John - Tracker Supp »

Is this resolved and related to your other post ?

Thanks.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: How to pass a COM/ActiveX object to JavaScript?

Post by DSSavant »

This was an alternative to passing COM objects into global script scope from outside the script (which was the original post). If I can't pass my own objects in, then can I create them within script. The answer seems to be NO. I cannot create something as simple as an XML DOM within script.

My question is if this is by design or if this is a bug?

Sorry for any confusion.
ugradedeveloper
User
Posts: 223
Joined: Wed Aug 22, 2007 4:40 pm

Re: How to pass a COM/ActiveX object to JavaScript?

Post by ugradedeveloper »

As far as I can see, the JavaScript implementation within PDF-XChange Viewer is not meant to be a general-purpose JS engine. It exists for the sake of implementing the Adobe Acrobat JavaScript interface. I wouldn't expect to see anything implemented that is not related to Acrobat. So, it doesn't surprise me if you can't use it to create DOM objects.

I trust that someone from the Tracker support team will correct me if I am mistaken here.

Lewis
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: How to pass a COM/ActiveX object to JavaScript?

Post by John - Tracker Supp »

Hi Lewis,

thanks - spot on - thats exactley the case.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: How to pass a COM/ActiveX object to JavaScript?

Post by DSSavant »

That's fair but it would nevertheless be a very nice feature since much of the work I must do is with annotations. Adobe implements "core" JavaScript functionality which is not Microsoft specific (or Windows) therefore I can see the scripting engine not having ActiveXObject() as a method. Having said that, in the Adobe JavaScript SDK you will note that they provide support for XML processing.

So, my question was not out of the ordinary for someone trying to accomplish way to much using JavaScript. If I could muck with all the annotations in a document, changing them as I see fit, from outside of JavaScript, life would be better and I would not need heavier tools such as an XML DOM to transfer hierarchical data to and from script.

Please consider the ability to instantiate my own COM objects (or plug-in support) a request or please provide an XML DOM type of object at the global level or... If it would help the good people at Tracker Software Products to know how my company is using the SDK within our product, just scream, I would love to help!
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: How to pass a COM/ActiveX object to JavaScript?

Post by Vasyl-Tracker Dev Team »

Hi, DSSavant

We will implement classical DOM model (based on the standard COM-technology) in the new version V3.

Best
Regards.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: How to pass a COM/ActiveX object to JavaScript?

Post by DSSavant »

THANK YOU!

It is so nice to have people listen to your requests. If Comcast or Verizon would just listen...
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17947
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: How to pass a COM/ActiveX object to JavaScript?

Post by Tracker Supp-Stefan »

Hey DSSavant,
Your words warm our hearths :)

Ver 3 is still a few months away but things are moving well.

Regards,
Stefan
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: How to pass a COM/ActiveX object to JavaScript?

Post by DSSavant »

A new request but on the same lines.

Will Version 3 be able to support COM object instantiation from within JavaScript. We are migrating a ton of customers off of Acrobat and are finding a ton of forms that are instantiating COM objects to pull data from databases, hit web services, etc. Without COM support in JavaScript (and therefore Forms) we cannot migrate these customers. For that much, we will start loosing customers because of it. Will the new javascript V8 engine support such a thing?
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: How to pass a COM/ActiveX object to JavaScript?

Post by Ivan - Tracker Software »

We are migrating a ton of customers off of Acrobat and are finding a ton of forms that are instantiating COM objects to pull data from databases, hit web services, etc. Without COM support in JavaScript (and therefore Forms) we cannot migrate these customers.
I would like to take a look at least on one PDF form with COM object.
For your info Adobe uses Mozilla SpiderMonkey JavaScript engine (need a link?). It doesn't support COM objects at all, so, it will be hard to use them in the PDF forms.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: How to pass a COM/ActiveX object to JavaScript?

Post by Vasyl-Tracker Dev Team »

Hi, DSSavant
var xmlDOM = new ActiveXObject("msxml2.DOMDocument");
This fails from within the FullDemo demo application. Outside of your product, it works like a dream.
We are not talking about a microsoft's JScript but about Adobe Acrobat's JavaScript objects model.
It doesn't support ActiveX objects. I think this is because supporting ActiveX in JS would be a dangerous hole in the pdf-viewer's security system.
With supporting of it you will be able to open document with special open-doc-script which can run any unmanaged code and harm/infect your machine.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: How to pass a COM/ActiveX object to JavaScript?

Post by DSSavant »

I will see if I can get you guys a few PDF Forms that we have to support. It may be a while as I will have to work though our support department to get them and remove any company specific / HIPAA data.

This much I do know, they are accessing database from within the form to query for data. I also have others that have indicated that they are making web service calls to load data into drop downs.
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: How to pass a COM/ActiveX object to JavaScript?

Post by John - Tracker Supp »

Thanks - we will look forward to receiving when you have available.

cheers
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
Post Reply