Viewer quickstart

Install the public Viewer, host its assets, and open a local document.

Install

sh
npm install @docviewkit/viewer

The package is designed for customer-hosted static assets. Do not load production Worker or Wasm files from an unpinned public CDN.

Mount the Web Component

html
<script type="module">
  import '@docviewkit/viewer';
</script>

<docviewkit-viewer id="document-viewer"></docviewkit-viewer>
ts
const viewer = document.querySelector('#document-viewer');
const file = document.querySelector('input[type=file]').files[0];

try {
  await viewer.open(file);
} catch (error) {
  if (error.code !== 'PDF_PASSWORD_REQUIRED') throw error;
  await viewer.open(file, { password: await requestPassword() });
}

Commercial preview boundary

Not a general production license

The current private package and preview Portal do not grant public production rights. Formats, browsers, deployment, support, and permitted use must be stated in a signed design-customer agreement.