Configuring the virtual viewer Client by using JavaScript
You can use JavaScript to start the IBM Daeja ViewONE Virtual viewer. In this approach, the initial page that the user sees displays a list of documents to be viewed, but not a viewer. By using this approach, you can support different viewers for different documents or you can display multiple viewers on the same page to view multiple documents simultaneously. You can also provide quick viewing of individual documents in a tabbed interface.
About this task
viewone
to
start the viewer:com.ibm.dv.client.Viewer.init('viewone');
If you do not call this function, the viewer does not run, and you have an empty object container on the screen and no viewer.
The following example illustrates the correct way to call this function:
function appendViewer1()
{
var viewerCode = '<object class="com.ibm.dv.client.Viewer" id="viewone1" width="900" height="600">' +
'<param name="filename" Value=http://myserver/sample.tif?&path=docs/>' +
'</object>';
document.getElementById('container').innerHTML = viewerCode;
com.ibm.dv.client.Viewer.init('viewone');
}
You can remove a viewer from a page by calling the following function:
com.ibm.dv.client.Viewer.destroy('viewone');
The following example demonstrates how to call the viewer to display four different documents: JPG, TIFF, JPG, and DOCX.
Procedure
- Edit the HTML page that displays the virtual viewer as shown in the examples.
-
Verify that you can access the viewer by entering the URL to the HTML page in a browser.
For example, enter the following URL:
http://myserver:8080/viewone/viewone_virtual.html