views:

317

answers:

1

I am using an activeX control for the PDF-XChange Viewer software.

Their support team gave me the following code sample:

<html>
<head>
<title>PDF-XChange Viewer ActiveX test...</title>
<script language="VBScript">
    Sub btnGetProperty_OnClick()
        PXCV.OpenDocument "/sandpit/appsheet/faxcentre2/Faxes/1234-56789-abc-123-3.pdf", 0, 0, 0
    End Sub
</script>
</head>
<body>

<input type="button" id="btnGetProperty" value="Open document"></br>
<object id="PXCV" classid="CLSID:FE36F0F3-F082-41B7-9EED-772505A7C054" width="500" height="480">
</object>

</body>
</html>

And this works fine in our standard browser (IE7) which is acceptable as this is an internal project.

However if I add this into a standard SharePoint page by editing it using SharePoint designer and adding the VBScript to the AdditionalPageHead content area and the INPUT and OBJECT tags into the Main content area, then the code fails.

The error that is reported is:

Error: Object required: 'PXCV'

Does anyone know what might be different between these two? Obviously SP includes a lot of other scripts and controls and the PXCV object is located entirely differently within the DOM, maybe this is the problem. Or is it top do with the presence of other scripts (all Javascript as far as I know) within the page?

+1  A: 

Chance are that the SharePoint web application does not load the code when it starts. I imagine you will have to include the underlying dll into the SharePoint bin or GAC it. Then you will have to edit the appropriate web.config to make register the control as a "safe control".

Nat
You would not get a javascript error reported at the browser if the script was not being rendered by SharePoint.
Charlie