Skip to content

A minimal node.js express app which has integrated PrizmDoc Viewer.

License

Notifications You must be signed in to change notification settings

Accusoft/hello-prizmdoc-viewer-with-nodejs-and-html

Repository files navigation

Hello PrizmDoc Viewer with node.js and HTML

A minimal node.js express app which has integrated PrizmDoc Viewer.

Setup

Requirements

Configure Connection to PAS

Configure how to connect to PAS (PrizmDoc Application Services) by editing the config.json5 file (this is just a JSON file with comments).

If you're just getting started, the easiest thing to do is to use PrizmDoc Cloud. We host PAS for you and all you need is your PrizmDoc Cloud API key. If you don't have an API key, you can get one for free at https://cloud.accusoft.com.

For PrizmDoc Cloud:

{
  "pasBaseUrl": "https://api.accusoft.com/prizmdoc",
  "apiKey": "YOUR_API_KEY"
}

For self-hosted PAS:

{
  "pasBaseUrl": "YOUR_PAS_BASE_URL",
  "pasSecretKey": "YOUR_PAS_SECRET_KEY",
}

Alternately, you can set or override any of these values via environment variables:

  • API_KEY
  • PAS_BASE_URL
  • PAS_SECRET_KEY

Install dependencies

npm install

Hybrid Viewing

This sample includes a Hybrid Viewing option, which allows users to seamlessly switch between server-side and client-side rendering modes, providing a faster and smoother viewing experience.

To enable client-side viewing, update the following configuration in config.json5:

  "enableClientSideViewing": "true"

Running the Sample

To start the app:

npm start

This will launch a small web application on http://localhost:8888.

You should see output like this:

> node index.js

[HPM] Proxy created: /pas-proxy  ->  https://api.accusoft.com/prizmdoc
[HPM] Proxy rewrite rule created: "^/pas-proxy" ~> ""
[HPM] Subscribed to http-proxy events:  [ 'error', 'close' ]
Application running at http://localhost:8888

When you visit http://localhost:8888, you should see a viewer with an example document, like this: