PrizmDoc Viewer v13.22 Release - Updated
Developer Guide / Viewer / Use Hybrid Viewing
In This Topic
    Use Hybrid Viewing
    In This Topic

    Overview

    PrizmDoc Viewer offers client-side PDF viewing functionality (also referred to as the 'Hybrid Viewing feature') that reduces the load on the server by parsing and rendering PDF documents completely on the client. This means the server is freed up to handle more concurrent users and process more documents.

    NOTE: Using the hybrid viewing feature requires metered licensing.

    NOTE: Printing is not available for the Hybrid Viewing feature. For a list of additional limitations, refer to getClientRestrictions in the ViewerControl API.

    Along with hybrid viewing, the pdf type of Viewing Package is specifically designed for hybrid viewing. While existing Viewing Packages (including on-demand) will work with hybrid viewing, we recommend using the pdf package type because it can be generated faster and requires less storage. See the /v2/ViewingPackageCreators endpoint's packageType parameter for more details.

    How to use Client-side PDF Viewing

    This section provides instructions on how to use client-side PDF viewing with PrizmDoc Viewer:

    Step 1: Create a Viewing Session

    First, you need to determine if your application will pre-convert documents (if you have access to them before viewing-time), or if it will perform on-demand viewing (if you don't have access to them before viewing-time).

    In this step, we will create an on-demand Viewing Package through the POST /ViewingSession endpoint in PAS.

    To use client-side PDF viewing, set the allowedClientFileFormats to ['pdf'] in the request body. We're using a PDF in the following example because they are immediately viewable. If your document is not a PDF, you'll need to create a viewing package to view your document client-side.

    Example Request

    POST http://localhost:3000/ViewingSession
    
    Content-Type: application/json
    {
      'source': {
        'type': 'url',
        'url': 'http://example.com/my.pdf',
        'documentId': 'myUniqueIdentifier
      },
      'allowedClientFileFormats': ['pdf']
    }
    
    

    Example Response

    200 OK
    
    Content-Type: application/json
    {
        "viewingSessionId":"-gchUEYvBE5OCgcWJajgoXcW7QD0I8zNDFlexD9hzbXkmrYlw8DrxJ-KiHAf2oTAL_HiHK1MsstBlNgZFCrcJQ"
    }
    
    

    Step 2: Instantiate the Viewer

    Next instantiate the Viewer, providing a documentId with the viewingSessionId value obtained from the POST /ViewingSession call in Step 1 above. See Initial Integration for more details on integrating the Viewer into your application.

    Example Instantiation

    const viewer = $('#viewerContainer').pccViewer({
      documentId: "-gchUEYvBE5OCgcWJajgoXcW7QD0I8zNDFlexD9hzbXkmrYlw8DrxJ-KiHAf2oTAL_HiHK1MsstBlNgZFCrcJQ"
    })
    
    

    Conclusion

    Congratulations, you are now using the client-side PDF feature to view a document!