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 theContent-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.
- Edit your
pas.win.yml
/pas.nix.yml
-
Set the License Key and Solution Name:
license.key: YOUR_LICENSE_KEY license.solutionName: YOUR_SOLUTION_NAME
Step 2: Set up a Database
- Use the PAS Configuring a Database page to configure a connection to your database, which is required for the Viewing Package feature.
-
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"
-
Edit your
pas.win.yml
/pas.nix.yml
-
Enable the Viewing Package feature by adding a line in the config:
feature.viewingPackages: "enabled"
-
Use the Run Database Scripts topic to create the necessary tables in the database for the Viewing Package feature.
- 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
-
Create a PDF Viewing Package from the
viewingPackageCreators
endpoint in PAS. Note thepackageType
ofpdf
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 }
-
Wait for the viewing package creation to be complete by checking the
percentComplete
in the response toGET /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 }
-
Now create a Viewing Session using the
documentId
from the previous step, again setting theallowedClientFileFormats
to['pdf']
andpackageType
topdf
.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
- To set up a viewer for your viewing session, follow the instructions in Create On-Demand Viewing Packages.