Virtual documents are documents composed of pages from multiple other source documents. They are similar to compound documents except that instead of being constructed out of multiple files by the backend server, they can be constructed dynamically in the browser or client code. Virtual documents have no restriction on which documents they can use pages from, except that they do not support media formats such as video and audio files. They can display some or all pages of a source document in any order, or even duplicate pages - for example, they can display page 1 of source document “A”, pages 1-3 of source document “B”, then page 1 of document “A” again.

Saving changes to Virtual Documents

Because virtual documents are a dynamic collection of pages and are not a true document stored in the content handler, they have some restrictions. Pages cannot be reordered when viewing a virtual document. Pages can be modified, such as by rotation, but those changes will be saved back to the source document for that page. Virtual documents do not support bookmarks or document notes. By default they also do not support annotations, although loading and saving annotations from and to the source documents can be manually enabled by setting the web.xml{:.filepath} configurations loadVirtualDocumentAnnotations and saveVirtualDocumentAnnotations to true. This will allow you to load annotations attached to each source document and save any new or modified annotations back to the source document. If the same source document page is duplicated in the virtual document, page modifications to or annotations on the last instance of the page will overwrite the other page instances.

Since virtual documents are not a true document, any changes to individual pages will be saved back to the individual source documents. However, virtual documents can be printed or exported as a whole to PDF or TIF. “Save As” can also be used to create a PDF or TIF copy of the virtual document as a true document that will support annotations, page reordering, bookmarks, and document notes - however this copy will be its own document unrelated to the original source documents.

Loading Virtual Documents

Virtual documents are constructed using a special syntax in the document ID. Any method that accepts a document ID to open a document will accept a virtual document ID, such as the documentId URL parameter or openInTab() Javascript API call. This syntax consists of the prefix “VirtualDocument:” followed by a comma-separated list of documentIds. For example, “VirtualDocument:BankStatement,SuccessStory” would create a virtual document of the source documents IDed by “BankStatement” and “SuccessStory”.

Advanced Virtual Document Syntax

Each document ID in the comma-separated list may be specified in the following ways:

File Name Description
ABC.tif This specifies that all pages of the document should be included.
ABC.tif[2] This specifies that only a single page from the document should be included.
ABC.tif[1-3] This specifies that a range of pages from the document should be included.

Note: To include non-consecutive pages from a single document, you need to specify the document each time in the virtual document string.

Virtual Document examples

Suppose that you have three documents, ABC.tif, EFG.pdf, and IJK.doc, each with three pages. You can create a virtual document from the entirety of all three documents:

http://localhost:8080/virtualviewer/index.html?documentId=VirtualDocument:ABC.tif,EFG.pdf,IJK.doc

Based upon the parameters described above, we know that we are displaying the entire contents of the original documents in our virtual document. If we wanted to include (for example) the full texts of ABC.tif and IJK.doc but only page two of EFG.pdf, we would enter:

http://localhost:8080/virtualviewer/index.html?documentId=VirtualDocument:ABC.tif,EFG.pdf[2],IJK.doc

Finally, if we wanted to include a range of pages from ABC.tif, the full EFG.pdf, and only page 3 from IJK.doc, we would enter:

http://localhost:8080/virtualviewer/index.html?documentId=VirtualDocument:ABC.tif[1-2],EFG.pdf,IJK.doc[3]

We can also use the PrizmDoc for Java Javascript API to open a document using the openInTab() method:

virtualViewer.openInTab("VirtualDocument:ABC.tif,EFG.pdf,IJK.doc[3]")