PrizmDoc® Viewer v13.28 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.

    Requirements & Considerations

    • See Licensing for PDF Viewing Package licensing requirements in specific PrizmDoc versions.

    • You will need to set up a database for both creating and viewing the Viewing Package.

    • 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: This is only required for specific PrizmDoc versions. See Licensing for more details.

    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": "complete",
          "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