PrizmDoc Viewer v13.5 - Updated
Create a Viewing Session
Get Started! > 4 - Integrate the Viewer with Your Application > Create a Viewing Session

This section provides instructions on How to Use a Viewing Session in PrizmDoc Application Services (PAS):

Step 1: Create a Viewing Session

The recommended method for creating a Viewing Session in Application Services is through the POST /ViewingSession endpoint. It is also possible to create a Viewing Session directly through PrizmDoc Server, without using PAS. For the equivalent of this guide for that endpoint, see the Using a Viewing Session topic for more details.

The body of the request specifies details of how the Viewing Session’s content will be generated and how its source document will be transferred to PrizmDoc Viewer, but does not necessarily provide the source document itself.

Example Request
Copy Code

POST http://localhost:3000/ViewingSession

Content-Type: application/json

{

   "source": {

       "type": "upload",

       "displayName": "sample.doc"

   },

   "render": {

       "html5":  {

           "vectorTolerance" : 1.0

       }

   }

}

Example Response
Copy Code

200 OK

Content-Type: application/json

{

    "viewingSessionId":"-gchUEYvBE5OCgcWJajgoXcW7QD0I8zNDFlexD9hzbXkmrYlw8DrxJ-KiHAf2oTAL_HiHK1MsstBlNgZFCrcJQ"

}

Step 2 (Optional): Upload the Source Document

If a Viewing Session was created with a source type of "upload", a second request is required to provide it with the source document. For other source types, the source document will have already been specified through the url, fileName, or documentId properties, and this step should be skipped.

Example Request
Copy Code

PUT http://localhost:3000/ViewingSession/u-gchUEYvBE5OCgcWJajgoXcW7QD0I8zNDFlexD9hzbXkmrYlw8DrxJ-KiHAf2oTAL_HiHK1MsstBlNgZFCrcJQ/SourceFile

Content-Type: application/octet-stream

Accusoft-Secret: mysecretkey

{binary data}

Example Response
Copy Code

200 OK

Step 3: Request Content

Once a Viewing Session has been created and provided with its source document, it becomes possible to make requests for content from it, as described in the HTML5 Viewing API.

Example Request
Copy Code

GET http://localhost:3000/Page/q/0?DocumentID=u-gchUEYvBE5OCgcWJajgoXcW7QD0I8zNDFlexD9hzbXkmrYlw8DrxJ-KiHAf2oTAL_HiHK1MsstBlNgZFCrcJQ&ContentType=png

Example Response
Copy Code

200 OK

Content-Type: image/png

{image data}