PDF Viewer Component Events

1. Ready to Open Document Event
Event: HRESULT NotifyCtrlReady();
Description: Ready to open document.
When the component finished the initialization the NotifyCtrlReady event is raised. The event allows you to open a new document after the component has released all the resources are ready to open a new document.
HTML + JScript
<html>
<script language=javascript id=clientEventHandlersJS>
function NotifyCtrlReadyEvent ()
{
PDFViewer1.Open “http://www.ocxt.com/demo/sample.pdf”
}
</script>

<body>
<object classid=”clsid: 44A8091F-8F01-43B7-8CF7-4BBA71E61E04 ” id=”PDFViewer1″ width=”657″ height=”452″>
<param name=”Toolbars” value=”0″>
</object>
</body>

<script language=”JScript” for=PDFViewer1 event=” NotifyCtrlReady ()”>
NotifyCtrlReadyEvent ();
</script>
</html>

2. Document Opened Event
Event: void OnDocumentOpened([in] BSTR FileName);
Description: Called when document is opened or new document added.
Every time a user opened a file successfully, the OnDocumentOpened event is raised. The event allows you to override the default behavior for the control and supply your own custom actions and dialog boxes to do normal file operations.
HTML + JScript
<script language=”JScript” for=PDFViewer1 event=” OnDocumentOpened(FileName)”>
OnDocumentOpenedEvent(FileName);
</script>
<script language=javascript>
function OnDocumentOpenedEvent(FileName)
{
Alert(“Respond the Document Opened Event.”);
}
</script>

3. Document Close Event
Event: void OnDocumentClosed();
Description: Called when document is closed.
Every time a user closed a file successfully, the OnDocumentClosed event is raised. The event allows you to override the default behavior for the control and supply your own custom actions and dialog boxes to do normal file operations.
HTML + JScript
<script language=”JScript” for= PDFViewer1 event=” OnDocumentClosed()”>
OnDocumentClosedEvent();
</script>
<script language=javascript>
function OnDocumentClosedEvent()
{
Alert(“Respond the Document Close Event.”);
}
</script>

4. Before Document Closed Event
Event: void BeforeDocumentClosed( [in,out] VARIANT* Cancel);
Description: Called before document is closed (may be canceled).
Every time before a user closed a document the OnActivationChange event is raised. The event allows you to override the default behavior for the control and supply your own custom actions and dialog boxes to do normal file operations.
HTML + JScript
<script language=”JScript” for= PDFViewer1 event=” BeforeDocumentClosed (Cancel)”>
OnBeforeDocumentClosedEvent(GoingActive);
</script>
<script language=javascript>
function OnBeforeDocumentClosedEvent (GoingActive)
{
Alert(“Respond the Before Document Closed Event.”);
}
</script>

5. Before Document Saved Event
Event: void BeforeDocumentSaved( [in,out] VARIANT* Cancel);
Description: Called before document is saved (may be canceled).
Every time a user opens a new document or closes a document the OnActivationChange event is raised. The event allows you to override the default behavior for the control and supply your own custom actions and dialog boxes to do normal file operations.
HTML + JScript
<script language=”JScript” for= PDFViewer1 event=” BeforeDocumentSaved( Cancel)”>
OnBeforeDocumentSavedEvent(GoingActive);
</script>

<script language=javascript>
function OnBeforeDocumentSavedEvent ( Cancel)
{
Alert(“Respond the Before Document Saved Event.”);
}
</script>

6. Before Right Click the Window
Event: HRESULT OnWindowBeforeRightClick();
Description: Called before right click the component. The event needs the DisableViewRightClickMenu method or DisableToolbarRightClickMenu method is called.

7. Before Double Click the Window
Event: HRESULT OnWindowBeforeDoubleClick ();
Description: Called before double click the component.

8. Before Download File
Event: HRESULT BeforeDownloadFile ();
Description: Called before downloading the file.

9. Download File Completed
Event: HRESULT DownloadFileComplete ();
Description: Called when the file was downloaded completely.