| FoxitPDFSDKforWeb v11.0.6 Archives Foxit PDF SDK for Web

Public Member Functions | List of all members
ViewerAnnotManager Class Reference
PDFViewCtrl » renderers » annotsRender

Viewer Annot Manager.
The behavior of the default annot can be reset by registerMatchRule. More...

## Public Member Functions
| getAnnotFlag (annot)
| Gets the annotation flags of an annotation in the PDFViewer. More...
| registerMatchRule (matchRule)
| Register the rule that matches the corresponding AnnotComponent. More...
| setViewerAnnotFlag (getAnnotFlagValue)
| Set annotation flags for PDFViewer. More...
| unRegisterMatchRule (matchRule)
| Rules for deregistration. More...

## Detailed Description

Viewer Annot Manager.
The behavior of the default annot can be reset by registerMatchRule.

## Member Function Documentation

## ◆ getAnnotFlag()

ViewerAnnotManager::getAnnotFlag | ( |  | annot | ) |
| inline

Gets the annotation flags of an annotation in the PDFViewer.

Parameters

  annot | Annot -

Returns
  AnnotFlag - The result of the union of the values in setViewerAnnotFlag and the flag values in annot itself

## ◆ registerMatchRule()

ViewerAnnotManager::registerMatchRule | ( |  | matchRule | ) |
| inline

Register the rule that matches the corresponding AnnotComponent.

Parameters

  matchRule | (pdfAnnot:Annot,annotComponent:AnnotComponent)=>undefined|(new<T extends AnnotComponent>()=>Class<T>) -

Returns
  Function -

Example:
  function example (pdfViewer) {
  pdfViewer.getAnnotManager().registerMatchRule(function (pdfAnnot, AnnotComponent) {
  if (pdfAnnot.getType() === 'Highlight') {
  return class CustomHighlightComponent extends AnnotComponent {
  constructor (annot, $ui, $handler, annotRender) {
  super(annot, $ui, $handler, annotRender);
  }
  static getDefaultContextMenuConfig () {
  // Modify right-click menu. Remove deleted right-click menu.
  var config = AnnotComponent.getDefaultContextMenuConfig();
  delete config.items.remove;
  return config;
  }
  onDoubleTap (e) {
  // do something about popup
  this.showPopup();
  // In order not to perform the default behavior, return false
  return false;
  }
  showPopup () {
  var popup = this.getModel().getPopup();
  }
  hidePopup () {
  var popup = this.getModel().getPopup();
  }
  }
  }
  })
  }

## ◆ setViewerAnnotFlag()

ViewerAnnotManager::setViewerAnnotFlag | ( |  | getAnnotFlagValue | ) |
| inline

Set annotation flags for PDFViewer.

Parameters

  getAnnotFlagValue | (annot:Annot)=>number - This return value merges with the flags of the PDF annotation itself

Example:
  function example (annotManager) {
  annotManager.setViewerAnnotFlag(function (annot) {
  var AnnotFlagEnum = {
  invisible: 1,
  hidden: 2,
  print: 4,
  noZoom: 8,
  noRotate: 16,
  noView: 32,
  readOnly: 64,
  locked: 128,
  toggleNoView: 256,
  lockedContents: 512,
  };
  if (annot.getTitle() === 'FoxitPDFSDKForWeb') {
  return AnnotFlagEnum.readOnly | AnnotFlagEnum.locked;
  }
  return 0; // all flags
  })
  }

See also
  Annot_Flags

## ◆ unRegisterMatchRule()

ViewerAnnotManager::unRegisterMatchRule | ( |  | matchRule | ) |
| inline

Rules for deregistration.

Parameters

  matchRule | (pdfAnnot:Annot,annotComponent:AnnotComponent)=>undefined|(new<T extends AnnotComponent>()=>Class<T>) -

@2025 Foxit Software Incorporated. All rights reserved.