One of the new additions to our recent PrizmDoc v11.0 release was a developer preview of our document pre-conversion feature. This is an exciting new addition, given many of our clients work with thousands—even millions—of large documents and can’t afford to waste even seconds waiting for files to process.
Pre-conversion will allow the conversion of documents and images prior to being requested for viewing. For example, you can determine certain files to be converted and rendered. The rendered viewing packages will be stored in cache. When documents are requested for viewing, PrizmDoc will check to see if the document has been already converted and if so, call the viewing package for that document from cache to the viewer. This will dramatically increase performance, since the documents and images are already converted and ready for viewing before they are requested.
Although the feature is still in late-stage development and is slated to be production-ready in an upcoming release, you can download and use the current developer preview to test and evaluate the functionality. First we’ll give a quick PrizmDoc overview, and then cover how to get started with pre-conversion.
The above diagram provides an overview of the core components of the PrizmDoc Client and Server
PrizmDoc Application Services
PrizmDoc Application Services (PAS) is installed "ready to run" via any of our four web tier samples (C#, MVC, Java, PHP).
Pre-converting documents in Application Services
When viewing large documents, a user can experience a delay viewing later pages in the document. The pre-conversion API allows the user to avoid any delay in viewing a fully converted document prior to the creation of a viewing session. Users may choose to pre-convert all documents over a certain file size or documents that are frequently viewed, allowing for a more tailored viewing experience.
How to Create a viewing Package by Pre-converting Documents
Pre-conversion is available by using the Pre-conversion API. Documents are pre-converted using the following steps:
Issue a POST request with the body of the request containing JSON formatted 'source' object. The source.type property can be a "document", "url" or "upload". In this example, "document" is used as a
viewingPackageCreator POST Body
. . .
A successful response to the above POST provides '
processId' in the response body.
. . .
Using the '
processId' obtained in step 1, query the pre-conversion process for the status.
A successful response body contains the JSON formatted properties '
state' and '
percentComplete'. The state value indicates whether it is 'complete' or 'processing' and the property '
percentComplete' indicates percentage amount complete.
Start polling the status by issuing a GET command using the above URL. It is recommended to use shorter intervals initially between the requests for the first few times. If it is still not complete, then the document may be large, requiring more processing time. In scenarios like this, an increase in the time interval between requests would be necessary to prevent a large number of status requests that could potentially cause network congestion. On 100% completion, the response body will among other information contain an output object with '
. . .
How to obtain information about the converted viewing Package
When the status is 100% complete, details can be obtained about the converted package by issuing the following request:
. . .
How to Delete a Previously Converted Package
A previously converted package can be deleted by issuing a DELETE request.
This request marks the package for asynchronous deletion. A successful response is as follows:
204 (No Content)
PrizmDoc Application Services 11.0 introduces the Viewing Packages feature. A Viewing Package is a cached version of a document that the PrizmDoc Viewer will use when displaying a document. Viewing a document from a Viewing Package will significantly reduce the load on PrizmDoc Server and will allow you to serve many more users per minute than you would otherwise be able to.
Viewing Packages are stored in both the filesystem and configured database. If using multiple instances of PAS, you must use a shared database and NAS (Network Attached Storage). The Running PrizmDoc Application Services on Multiple Servers topic can provide more information for configuring PAS in Multi-Server Mode.
By default, storage is configured in the following way:
|Config Key ||Storage Provider ||Description |
|viewingPackagesData ||database ||Data about a Viewing Package. This is the data that can be retrieved from GET /v2/viewingPackages. |
|viewingPackagesProcesses ||database ||Data about a Viewing Package creator process. This is the data that can be retrieved from GET /v2/viewingPackageCreators. |
|viewingSessionsData ||database ||Data about a Viewing Session. When creating a Viewing Session, an entry is added to this table. |
|viewingSessionsProcessesMetadata ||database ||Data about processes for a Viewing Session. This is currently used for content conversion and markup burner processes. |
|viewingPackagesArtifactsMetadata ||database ||Metadata for a viewing package artifact. This is used to find specific artifacts for a package and contains the artifact type, the file name in the filesystem among other important information. |
|viewingPackagesArtifacts ||filesystem ||Artifacts for a Viewing Package. These include SVG and raster content for every page, the source document, and other artifacts the Viewing Client will likely request. |
Viewing Packages are opt-in and require special configuration to work properly. At a minimum, your configuration should include the following:
# Feature toggles
# Database configuration
# Default timeout for the duration of a viewing session
Creating a Viewing Package through Pre-Conversion provides a way to generate packages whenever it makes the most sense for your application to do so. It allows you to make use of down-time for Pre-Conversion to reduce load in high traffic periods. Pre-Conversion does all the work of creating a Viewing Package whenever it is requested. It starts a process that will begin downloading content and allow you to poll for progress.
It is recommended that you maintain a queue of Pre-Conversions so you don’t overload the server and have faster turnaround time. We recommend a maximum of five Pre-Conversion processes at a time per PrizmDoc Application Services and PrizmDoc Server instance. This will allow packages to be created quickly while maintaining a sustainable load.
Creating a Viewing Package through On-Demand Caching is a seamless process through the Viewing Session API. On-Demand Caching allows you to trigger a Viewing Package creation process in the background and use the resulting Viewing Package when it is ready. This feature is designed to allow immediate viewing using PrizmDoc Server while caching a package for subsequent views of the same document.
As an example, consider this request for a Viewing Session:
This request will always return a
viewingSessionId regardless of the status of the matching Viewing Package. If a Viewing Package does not currently exist with the given
documentId, PrizmDoc Server will handle document viewing while a background process creates a Viewing Package. Once the background process is complete, PrizmDoc Application Services will handle all further viewing sessions until the Viewing Package expires (24 hours by default).
Given the increasing digital nature of document management, the pre-conversion services in PrizmDoc are an exciting addition to our already-robust suite of features. Pre-converting, rendering, and storing documents in cache will provide a more seamless experience, allowing users to immediately call and view documents and images. We believe it’s a game-changer that will allow many of our clients to significantly streamline their processes.
Accusoft provides a full spectrum of document, content, and imaging solutions as fully supported, enterprise-grade, client-server applications, mobile apps, cloud services, and software development kits. The company is focused on solving document lifecycle complexities through:
- A customer-focused approach
- Continuous product development
- Proactive support
- Forward-thinking leadership
Founded in 1991, Accusoft has grown through persistent product innovation and strategic mergers and acquisitions into the best-in-class solutions provider it is today. The company has been awarded 30 patents and is recognized as a thought leader in the industry.