PrizmDoc
Pre-Converting Documents

Pre-converting documents in Application Services

When viewing large documents, a user can experience a delay viewing later pages in the document. The Pre-conversion API allows the user to avoid any delay in viewing a fully converted document prior to the creation of a viewing session.

This section describes a typical use in pre-converting and management of the pre-converted viewingPackages:

  1. How to Create a viewingPackage by Pre-converting Documents.
  2. How to Obtain Information for a viewingPackage.
  3. How to Delete a viewingPackage

How to Create a viewingPackage by Pre-converting Documents

Pre-conversion is available by using the Pre-conversion API. For detailed information, refer to the PrizmDoc Application Services RESTful Viewing Package Creators API section.

Documents are pre-converted using the following steps.

Step 1

Issue a POST request with the body of the request containing JSON formatted 'source' object. The source.type property can be a "document", "url" or "upload".

In this example, "document" is used as a source.type property.

POST http://localhost:3000/v2/viewingPackageCreators

viewingPackageCreator POST Body

Content-Type: application/json
{
    "input": {
        "source": {
            "type": "document",
            "fileName": "sample.doc",
            "documentId": "unT67Fxekm8lk1p0kPnyg8",
            . . .
        },
        "viewingPackageLifetime": 2592000
    }
}

A successful response to the above POST provides 'processId' in the response body.

200 OK
Content-Type: application/json
{
    "input": {
        "source": {
            "type": "document",
            "fileName": "sample.doc",
            "documentId": "unT67Fxekm8lk1p0kPnyg8",
            . . .
        },
        "viewingPackageLifetime": 2592000
    },
    "expirationDateTime": "2015-12-09T06:22:18.624Z",
    "processId": "khjyrfKLj2g6gv8fdqg710",
    "state": "processing",
    "percentComplete": 0
}

Step 2

Using the 'processId' obtained in the step 1, query the pre-conversion process for the status.

GET http://localhost:3000/v2/viewingPackageCreators/khjyrfKLj2g6gv8fdqg710

A successful response body contains the JSON formatted properties 'state' and 'percentComplete'. The state value indicates whether it is 'complete' or 'processing' and the property 'percentComplete' indicates percentage amount complete.

Start polling the status by issuing a GET command using the above URL. It is recommended to use shorter intervals initially between the requests for the first few times. If it is still not complete, then the document may be large, requiring more processing time. In scenarios like this, an increase in the time interval between requests would be necessary to prevent a large number of status requests that could potentially cause network congestion. On 100% completion, the response body will among other information contain an output object with 'packageExpirationDateTime' property.

200 OK
Content-Type: application/json
{
    "input": {
       "source": {
            "type": "document",
            "fileName": "sample.doc",
            "documentId": "unT67Fxekm8lk1p0kPnyg8",
            . . .
       },
       "viewingPackageLifetime": 2592000
    },
    "output": {
        "packageExpirationDateTime": "2016-1-09T06:22:18.624Z"
    },
    "expirationDateTime": "2015-12-09T06:22:18.624Z",
    "processId": "khjyrfKLj2g6gv8fdqg710",
    "state": "complete",
    "percentComplete": 100
}

How to obtain information about the converted viewingPackage

For obtaining detailed information about the converted viewingPackage, refer to the PrizmDoc Application Services RESTful Viewing Packages API section.

When the status is 100% complete, details can be obtained about the converted package by issuing the following request:

GET http://localhost:3000/v2/viewingPackages/unT67Fxekm8lk1p0kPnyg8

Response Body

200 OK
Content-Type: application/json
{
    "input": {
        "source": {
            "type": "document",
            "fileName": "sample.doc",
            "documentId": "unT67Fxekm8lk1p0kPnyg8",
            . . .
        },
        "viewingPackageLifetime": 2592000
    },
    "state": "complete",
    "packageExperationDateTime": "2016-1-09T06:22:18.624Z"
}

How to Delete a Previously Converted Package

For obtaining detailed information about deleting converted viewingPackage, refer to the PrizmDoc Application Services RESTful Viewing Packages API section.

A previously converted package can be deleted by issuing a DELETE request.

DELETE http://localhost:3000/v2/viewingPackages/unT67Fxekm8lk1p0kPnyg8

This request marks the package for asynchronous deletion. A successful response is as follows:

204 (No Content)

Pre-Conversion Services developer preview

Pre-Conversion Services are included as a "Developer Preview." This feature is in late-stage development and api's marked as such should be used for evaluation purposes only and should not be used in production deployments. Note that these API's may undergo change prior to feature completion. The Pre-Conversion Services will be feature complete in PrizmDoc version 11.2.

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback