PrizmDoc Viewer v13.19 - Updated
Developer Guide / PrizmDoc Server / How To Examples / Pre-convert Documents for the Accusoft PDF Viewer
In This Topic
    Pre-convert Documents for the Accusoft PDF Viewer
    In This Topic

    Introduction

    If you want to use the Accusoft PDF Viewer to view documents of any format supported by PrizmDoc Server, you can pre-convert your documents to PDF with the new "v3" viewing package REST APIs.

    NOTE: These APIs are not for use with the PrizmDoc Viewer Client. If you need to pre-convert a document for the PrizmDoc Viewer client, use the PAS "v2" viewing package creators and viewing packages REST APIs instead (see Work with Viewing Packages in the PAS Developer Guide for more information).

    NOTE: Integration with Accusoft PDF Viewer is currently only available for on-premise deployments.

    NOTE: This feature is disabled by default. See Integration with Accusoft PDF Viewer on how to enable and configure this feature.

    The following steps walk you through using the PrizmDoc Server REST API to pre-convert documents for use with Accusoft PDF Viewer. You can also find a minimal example of a React app which integrates the Accusoft PDF Viewer with PrizmDoc Viewer here.

    Step 1: Upload Your Source Document

    • Upload the source document that you want to pre-convert to PDF.
    • In response to this request, you will receive a file ID that is used to reference the source document in later requests.
    • See the Work Files API for more details about this request.

      Example

       POST /PCCIS/V1/WorkFile?FileExtension=docx
       Content-Type: application/octet-stream
       [binary data]
      
        200 OK
        Content-Type: application/json
        {
            "fileId": "rxpuVUxMFWzAZFUmQ6fmYA",
        }
      
      

    Step 2: Start the "v3" Viewing Package creation

    • Start the viewing package creation process, specifying the file ID of the source document, obtained in the previous step, and your own unique identifier for the new viewing package.
    • In response to this request, you will receive a Viewing Package Creator process ID that is used to track the viewing package creation process.
    • See the "v3" Viewing Package Creators API for more details about this request.

      Example

       POST /v3/viewingPackageCreators
       Content-Type: application/json
      
       {
         "input": {
           "packageId": "MyPackage_IHN0YXJzaGlwIE5vc3Ryb21v",
           "source": {
             "type": "workFile",
             "fileId": "rxpuVUxMFWzAZFUmQ6fmYA"
           },
           "lifetimeAfterLastUse": "30d"
         }
       }
      
       HTTP 200 OK
       Content-Type: application/json
      
       {
           "input": {
               "packageId": "MyPackage_IHN0YXJzaGlwIE5vc3Ryb21v",
               "source": {
                   "type": "workFile",
                   "fileId": "rxpuVUxMFWzAZFUmQ6fmYA"
               },
               "lifetimeAfterLastUse": "30d"
           },
           "expirationDateTime": "2021-09-13T10:58:15.551Z",
           "percentComplete": 0,
           "processId": "_wDAkhncr8_2PUWJc3Vfdw",
           "state": "processing"
       }
      
      

    Step 3: Check Status of the "v3" Viewing Package Creator Resource

    • The process to convert your source document to PDF runs asynchronously on the PrizmDoc server. The POST request you sent in Step 2 will return immediately and before the output is ready. This means you will need to check the status of the process by sending a GET request to the resource you just created.
    • In response to this request, JSON will be returned that includes a state property. When this property is "complete", you can proceed to the next step.
    • See the "v3" Viewing Package Creators API for more details about this request.

      Example

      GET /v3/viewingPackageCreators/_wDAkhncr8_2PUWJc3Vfdw
      
      HTTP 200 OK
      Content-Type: application/json
      
      {
          "input": {
              "packageId": "MyPackage_IHN0YXJzaGlwIE5vc3Ryb21v",
              "source": {
                  "type": "workFile",
                  "fileId": "rxpuVUxMFWzAZFUmQ6fmYA"
              },
              "lifetimeAfterLastUse": "30d"
          },
          "percentComplete": 100,
          "expirationDateTime": "2021-09-13T10:58:15.000Z",
          "processId": "_wDAkhncr8_2PUWJc3Vfdw",
          "state": "complete"
      }
      
      

    Step 4 (optional): Check Status of the "v3" Viewing Package

    • This step might be useful if you created the viewing package and did not use it for a while, to make sure the package has not expired yet.
    • See the "v3" Viewing Packages API for more details about this request.

    Example

       GET /v3/viewingPackages/MyPackage_IHN0YXJzaGlwIE5vc3Ryb21v
    
       HTTP 200 OK
       Content-Type: application/json
    
       {
        "expirationDateTime": "2021-10-13T10:38:17.000Z",
        "creationDateTime": "2021-09-13T10:38:15.000Z",
        "bytes": 6145,
        "lifetimeAfterLastUse": "30d"
       }
    
    

    Step 5: Get PDF Contents of the "v3" Viewing Package

    • Download PDF representation of the original document used to create the viewing package
    • See the "v3" Viewing Packages API for more details about this request.

      Example

      GET /v3/viewingPackages/MyPackage_IHN0YXJzaGlwIE5vc3Ryb21v/content/pdf
      
      HTTP 200 OK
      Content-Type: application/pdf
      
      <PDF file bytes>