Introduction
This section provides instructions on how to use a Viewing Session in PrizmDoc Server:
- Step 1: Create a Viewing Session
- Step 2: (Optional) Upload the Source Document
- Step 3: (Optional) Start the Session
- Step 4: Request Content
- Step 5: (Optional) Stop the Session
Step 1: Create a Viewing Session
The recommended method of creating a Viewing Session is through the POST /ViewingSession endpoint in PAS.
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, but does not necessarily provide the source document itself.
Example Request
http://localhost:18681/PCCIS/V1/ViewingSession
Content-Type: application/json
{
"render": {
"html5": {
"alwaysUseRaster": false
}
}
}
Example Response
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 documentSource
of "api
", a second request is required to provide it with the source document. For other source types, the source document will have already been specified in the externalId
property, and this step should be skipped.
Example Request
http://localhost:18681/PCCIS/V1/ViewingSession/u-gchUEYvBE5OCgcWJajgoXcW7QD0I8zNDFlexD9hzbXkmrYlw8DrxJ-KiHAf2oTAL_HiHK1MsstBlNgZFCrcJQ/SourceFile
Content-Type: application/octet-stream
{binary data}
Example Response
200 OK
Step 3: (Optional) Start the Session
By default, content generation for a Viewing Session does not begin until content is first requested from it. However, it is possible to manually kick off conversion beforehand in order to improve the response time of subsequent content requests.
Example Request
http://localhost:18681/PCCIS/V1/ViewingSession/u-gchUEYvBE5OCgcWJajgoXcW7QD0I8zNDFlexD9hzbXkmrYlw8DrxJ-KiHAf2oTAL_HiHK1MsstBlNgZFCrcJQ/Notification/SessionStarted
Content-Type: application/json
{
"Viewer": "HTML5"
}
Example Response
200 OK
Step 4: 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 reference.
Example Request
http://localhost:18681/PCCIS/V1/Page/q/0?DocumentID=u-gchUEYvBE5OCgcWJajgoXcW7QD0I8zNDFlexD9hzbXkmrYlw8DrxJ-KiHAf2oTAL_HiHK1MsstBlNgZFCrcJQ&ContentType=png
Example Response
200 OK
Content-Type: image/png
{image data}
Step 5: (Optional) Stop the Session
A Viewing Session may be made unavailable prior to the time it would normally expire with a SessionStopped
request. See the API reference for details of what properties can be set for the error response returned for subsequent requests against the stopped session.
Example Request
http://localhost:18681/PCCIS/V1/ViewingSession/u-gchUEYvBE5OCgcWJajgoXcW7QD0I8zNDFlexD9hzbXkmrYlw8DrxJ-KiHAf2oTAL_HiHK1MsstBlNgZFCrcJQ/Notification/SessionStopped
Example Response
200 OK