PrizmDoc® Viewer v14.0 Release - Updated
PrizmDoc Viewer / Developer Guide / Get Started with Hybrid Viewing / License & Create PDF Viewing Packages
In This Topic
    License & Create PDF Viewing Packages
    In This Topic

    Overview

    The Hybrid Viewing and PDF Viewing Package creation features reduce the overall server usage by enabling document rendering in the Viewer and the creation of much smaller viewing packages.

    To take advantage of these features, PAS needs to be configured with a Metered License, Offline Metered License or OEM License (you can use the same license to configure both PrizmDoc Server and PAS). If you do not want to use these features, you do not need to install a license key in PAS. For more information on how to set up the license in the PAS configuration, see PAS Licensing, or see below.

    NOTE: If you want to evaluate Hybrid Viewing, contact info@accusoft.com.

    Requirements & Considerations

    • You are required to use Metered Licensing, Offline Metered Licensing or OEM Licensing with PAS to enable the creation of PDF-only Viewing Packages and view them client-side using the Hybrid Viewing feature. You will need to set up a database for both creating and viewing the Viewing Package and tracking your Metered License or Offline Metered License usage.

    • If you want to create the original, full Viewing Packages and view them with SVG viewing, then you do not need a license for PAS. However, a database is still required.

    • If you are using the Hybrid Viewing feature and enabling a Content Security Policy, you will need to add the worker-src blob: parameter to the Content-Security-Policy tag.

    Get Started with PAS Licensing & PDF Viewing Package Creation

    Step 1: Set up the License

    NOTE: A Metered License, Offline Metered License or OEM License is required for this feature.

    1. Edit your pas.win.yml / pas.nix.yml
    2. Set the License Key and Solution Name:

      license.key: YOUR_LICENSE_KEY
      license.solutionName: YOUR_SOLUTION_NAME
      
      

    Step 2: Set up a Database

    1. Use the PAS Configuring a Database page to configure a connection to your database, which is required for the Viewing Package feature.
    2. Once you have set up the database, you should have something similar in your PAS config file as shown below:

      NOTE: The example below is for a MySQL database. Your code may look slightly different if you are using an SQL Server database.

      database.adapter: mysql
      database.connectionString: "mysql://dbUser:dbPassword@host.docker.internal:3306/dbName"
      
      
    3. Edit your pas.win.yml / pas.nix.yml

    4. Enable the Viewing Package feature by adding a line in the config:

      feature.viewingPackages: "enabled"
      
      
    5. Use the Run Database Scripts topic to create the necessary tables in the database for the Viewing Package feature.

    6. Your PAS is now ready to create Viewing Packages. The following steps will help you verify that everything is functioning properly.

    Step 3: Verify that everything works by creating a Viewing Session from a Viewing Package

    1. Create a PDF Viewing Package from the viewingPackageCreators endpoint in PAS. Note the packageType of pdf is how you indicate to PAS that you want a PDF Viewing Package.

      Example Request

      POST http://localhost:3000/v2/viewingPackageCreators
      
      Content-Type: application/json
      {
          "input": {
              "source": {
                  "type": "document",
                  "fileName": "PdfDemoSample.pdf",
                  "documentId": "test-id-1",
                  "packageType": "pdf"
              },
              "viewingPackageLifetime": 2592000
          }
      }
      
      

      Example Response

      200 OK
      
      Content-Type: application/json
      {
          "input": {
              "source": {
                  "documentId": "test-id-1",
                  "type": "document",
                  "packageType": "pdf",
                  "fileName": "PdfDemoSample.pdf"
              },
              "viewingPackageLifetime": 2592000
          },
          "expirationDateTime": "2022-11-14T20:39:31.000Z",
          "processId": "YOxF4JFiuaXjfsfNKga1iw",
          "state": "queued",
          "percentComplete": 0
      }
      
      
    2. Wait for the viewing package creation to be complete by checking the percentComplete in the response to GET /v2/viewingPackageCreators.

      Example Request

      GET http://localhost:3000/v2/viewingPackageCreators/<your-process-id>
      
      

      Example Response

      200 OK
      
      Content-Type: application/json
      {
          "input": {
              "source": {
                  "documentId": "test-id-1",
                  "type": "document",
                  "packageType": "pdf",
                  "fileName": "PdfDemoSample.pdf"
              },
              "viewingPackageLifetime": 2592000
          },
          "expirationDateTime": "2022-11-14T20:40:28.000Z",
          "processId": "YOxF4JFiuaXjfsfNKga1iw",
          "state": "processing",
          "percentComplete": 100
      }
      
      
    3. Now create a Viewing Session using the documentId from the previous step, again setting the allowedClientFileFormats to ['pdf'] and packageType to pdf.

      Example Request

      POST http://localhost:3000/ViewingSession
      
      Content-Type: application/json
      {
          "source": {
              "type": "upload",
              "displayName": "PdfDemoSample.pdf",
              "documentId": "test-id-1",
              "packageType": "pdf"
          },
          "allowedClientFileFormats": ["pdf"]
      }
      
      

      Example Response

      200 OK
      
      Content-Type: application/json
      {
          "viewingSessionId":
          "ceDKddC6Lx6vYMyzmRhVl0xoDsxHlPHHQQUMsNqs1YeXLiwX-5NNBjmHy0SITQdTbliB8J_y5Inn5BvBG460Sg"
      }
      
      

    Next Steps