Accusoft PDF Viewer Documentation

v3.11.158639

How To Enable Annotation Tools

By default, annotation tools are not shown in the UI. This guide explains how to enable annotation tools so that your users can annotate a document.

Prerequisites

Using annotation tools requires a Professional license. You can evaluate Professional features by setting licenseKey to 'eval' when creating the viewer.

Directions

To enable annotation tools, set these extra options when calling create:

  • Set licenseKey to a Professional license key or 'eval'
  • Set allowedControls to an object with one or more of the following properties set to true:
    • ellipseTool
    • freehandDrawingTool
    • freehandSignatureTool
    • fullScreenToggle
    • lineTool
    • rectangleTool
    • textHighlightTool

For example, to enable all annotation tools when creating the viewer:

(async () => {
  // Create the viewer
  window.myViewer = await PdfViewerControl.create({
    container: document.getElementById('myContainer'),

    // URL or Uint8Array for a PDF
    sourceDocument: YOUR_SOURCE_DOCUMENT

    // Use a Professional license key or the value 'eval'
    licenseKey: 'YOUR_LICENSE_KEY',

    // Configure the annotation tools you want in the UI
    allowedControls: {
      ellipseTool: true,
      freehandDrawingTool: true,
      freehandSignatureTool: true,
      lineTool: true,
      rectangleTool: true,
      textHighlightTool: true
    }
  });
})();

Choosing Which Tools Are in the UI

The contents of allowedControls will determine which tools are shown in the UI. You can easily remove certain tools by setting them to false.

For example, to only show the rectangle and ellipse annotation tools in the UI, you could do this:

allowedControls: {
  // Include ellipse and rectangle tools in the UI
  ellipseTool: true,
  rectangleTool: true,

  // Do not include any other annotation tools in the UI
  freehandDrawingTool: false,
  freehandSignatureTool: false,
  lineTool: false,
  textHighlightTool: false
}

Related

© 2022 Accusoft Corporation. All rights reserved.