Using ActiveX Controls in a Clientside Web Application

Ciansoft's ActiveX controls can be used in clientside applications running in a web browser. When the user accesses a web page, the control is downloaded to the client machine and is run from the browser using a scripting language such as Javascript or VBScript.

We have an example using TwainControlX with Javascript to scan an image and save it to the local, client machine. The same principles can be applied to our other ActiveX controls.

View the example web page.

Download the example. (3kB)

Licensing

The following description of licensing does NOT apply to WebTwainX which is licensed differently. Refer to this page for details. However, the technical details about how licence files work in web pages are applicable to all our products.

If you are developing a clientside application to run on a single server, but distributed to many possible client machines, only a single user licence for the ActiveX control is required. This is regardless of how many clients will access the server, or whether the application is running over the internet or a local intranet.

You may wish to run your application on the server, while at the same time maintaining a development system for testing and troubleshooting. This would mean that the software is being used on two computers simultaneously, and for this a 2 user licence is required.

For the control to run on the client machines, it needs to be able to read the licence information normally held in the .LIC file. To enable this, you must create a licence package (.LPK) file which is stored on the server and read by the browser when needed. We provide the .LPK files for both the trial and full versions of TwainControlX, WebTwainX and PDFBuilderX, and these are copied to the installation directory after running our installers.

Adding the Control to a Web Page

The ActiveX control is added to the web page by inserting two OBJECT tags into the body of the HTML. See the example page for the details of these tags.

The first OBJECT tag holds the path and name of the .LPK file on the server. This tag includes a 32 character class id. This must never be changed, it is the same class id for every OCX control used in this way.

The second OBJECT tag holds the path and name of the ActiveX control. This can either be the .OCX file, as supplied by Ciansoft, or it can be compressed as a .CAB file. Any suitable file compression utility can be used to produce the .CAB file. This tag includes the 32 character class id of the control. The one used in our example is for the trial version of TwainControlX. If you have purchased the full version of TwainControlX, you should replace this class id with "C46A890E-8107-11D8-8671-00C1261173F0".

For PDFBuilderX, the class id for the trial version is "00E7C7F8-71E2-498A-AB28-A3D72FC74485" and for the full version it is "628DB55E-78CB-46D6-99C9-F65EC47FE138".

Scripting

To use the control a suitable scripting language such as Javascript or VBScript must be used. Our example uses Javascript. An id is assigned to the control when it is declared in the second OBJECT tag and this id is used to identify the control object in the script. In our example the id is "tcx1". We have used a button with the onclick event assigned to a Javascript function "rundemo". This function contains the code that acquires and saves the image.

Digitally Signed CAB Files

If you purchase a licence for the full version of TwainControlX or PDFBuilderX, we provide a digitally signed CAB file. The digital signature identifies Ciansoft as the control author and guarantees to your users that the control is genuine. We do not provide a signed CAB file for trial versions.

For WebTwainX, all OCX and CAB files provided are digitally signed, including the trial version.