How Can I Optimize Viewing Session Loading Times in PrizmDoc Viewer?

Modified on Fri, Jan 3 at 12:25 PM

When a document is displayed in PrizmDoc Viewer, a Viewing Session is created. A Viewing Session is a temporary resource for converting and delivering your file to the browser. This can be resource-intensive if done on-demand every time. There are some methods to improve performance:

  • Viewing Packages (pre-conversion)
  • Hybrid Viewing (client-side rendering)
  • Caching Strategies

Viewing Packages


A Viewing Package contains pre-converted, browser-ready content that speeds up viewing. If you know in advance which documents your users will access repeatedly, you can pre-convert them so that you can bypass the on-demand conversion each time the document is requested and therefore reducing the loading times for the end user. 


How to Create: 

1. POST request to /v2/viewingPackageCreators with a unique documentId.

2. If needed, PUT the source file to /v2/viewingPackageCreators/{processId}/SourceFile.

3. GET status until process is complete.
4. Use the same documentId in a new viewing session, which will use the pre-converted content.


Benefits include faster load times, reduced server load, and freeing up server resources to handle more requests. 


Documentation: 


Hybrid Viewing

Hybrid Viewing off-loads most PDF rendering to the browser, which helps reduce server processing. For PDFs, you can just deliver the PDF directly to the browser for rendering. For non-PDF documents, you can pre-convert them to PDF using PrizmDoc Server, then serve the PDF versions to the client.


Note: Hybrid Viewing and PDF-only viewing packages require a Metered License, Offline Metered License, or OEM License for PAS. Please contact support@accusoft.com if you have questions regarding your license. 


How to use:

1. Create a Viewing Package with packageType = pdf

This generates only the PDF version instead of a full set of raster/SVG data, making the package smaller and faster to create.

2. Create a Viewing Session with allowedClientFileFormats = pdf

The viewer will request only the PDF from PAS and the client/browser handles the rendering. 


Benefits include faster document viewing, lower server resources, and reduced storage.


Documentation: 


Caching Stategies & Server Configuration

PrizmDoc Server caches both the original document and the converted artifacts to improve performance on repeat viewings.

  • Session & Cache Lifetimes: Configure the viewing.sessionLifeTime and viewing.cacheLifeTime options in prizm-services-config.yml
    • viewing.sessionLifeTime controls how long a Viewing Session remains usable for a given user. 
    • viewing.cacheLifeTime controls how long the converted content remains on disk for reuse.
  • serverCaching: Set in the POST to /viewingSession JSON body to control whether new sessions reuse prior cached data or convert from scratch. 
  • Cache location
    • In high-traffic environments, placing the cache on faster storage (SSD) or shared memory (/dev/shm on Linux) significantly improves performance and reduces server I/O bottlenecks. 


Documentation:


Other Considerations:

  • Use the latest version of Prizmdoc: new releases often contain optimization improvements and bug fixes.
  • Clean up cache periodically


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article