| FoxitPDFSDKforWeb v11.0.4 Archives Foxit PDF SDK for Web

Public Member Functions | List of all members
AnnotationAuthorityManager Class Reference
PDFViewCtrl

Annotation Authority manager class, It used to control the permission of each annotations in the PDF document. It can be obtained via Viewer.PDFViewer::getAnnotAuthorityManager() method. More...

Inheritance diagram for AnnotationAuthorityManager:

## Public Member Functions
Promise< AnnotationPermission > | getPermission (annot)
| Obtains the newest permission of the specified annot. More...
void | setAnnotPermissionCallback (getAnnotPermissionsCallback:GetAnnotPermissionsCallback)
| Set the callback function to update the viewer-level permissions for Annotation. If the current document is not open, the updateAll method does not need to be called to notify the permission change event. The update event will be triggered automatically when the document is opened. If a document is already open, then updateAll needs to be called. if the callback function has not changed, but the external data on which the callback function depends has changed, then only updateAll needs to be called. More...
| subscribe (annot:Annot, callback:(newPermission:AnnotationPermission, annot:Annot)=> void)
| Subscribe to monitor an annotation permission changes. Different from PDFViewCtrl.constants.ViewerEvents.annotationPermissionChanged event, this callback will be called after subscribe immediately. More...
Promise< void > | update (annot)
| Update specified annotation's permission info. More...
| updateAll ()
| Update all loaded annotation's permission info. More...
Public Member Functions inherited from Disposable
| addDestroyHook (...hooks)
| Add a function to destroyHooks list, which will be called during destroy. More...
| destroy ()
| ownsTo (owner)
| Establishes an ownership relationship where this instance will be destroyed when the owner is destroyed. Additionally, the owner will be automatically removed from the destroyHooks list when this instance is destroyed. More...

## Detailed Description

Annotation Authority manager class, It used to control the permission of each annotations in the PDF document. It can be obtained via Viewer.PDFViewer::getAnnotAuthorityManager() method.

Since
  7.6.0

## Member Function Documentation

## ◆ getPermission()

Promise<AnnotationPermission> AnnotationAuthorityManager::getPermission | ( | annot |  | ) |

Obtains the newest permission of the specified annot.

Parameters

  annot | Annot - The annotation instance

Returns
  Promise<AnnotationPermission> -

Since
  7.6.0

## ◆ setAnnotPermissionCallback()

void AnnotationAuthorityManager::setAnnotPermissionCallback | ( | getAnnotPermissionsCallback:GetAnnotPermissionsCallback |  | ) |

Set the callback function to update the viewer-level permissions for Annotation. If the current document is not open, the updateAll method does not need to be called to notify the permission change event. The update event will be triggered automatically when the document is opened. If a document is already open, then updateAll needs to be called. if the callback function has not changed, but the external data on which the callback function depends has changed, then only updateAll needs to be called.

Parameters

  getAnnotPermissionsCallback | GetAnnotPermissionsCallback - This function is used to generate a permission list(Refer to PDFViewCtrl.constants.ANNOTATION_PERMISSION ) based on the annotation information. This function allows viewers to control the permissions of each annotation according to their actual needs. When this function returns Promise.resolve(undefined), Promise.resolve(null), or Promise.resolve([ANNOTATION_PERMISSION.fully]), it enables all viewer-level permissions, and if it returns Promise.resolve(undefined). resolve([]), then it disables all viewer-level permissions. If you want to enable the specified viewer-level permissions, you can combine different ANNOTATION_PERMISSION enumeration values, e.g.:Promise.resolve([ANNOTATION_PERMISSION.deletable, ANNOTATION_PERMISSION. editable])

Returns
  void -

See also
  ANNOTATION_PERMISSION

Since
  9.0.0

Examples:

const annotAuthMgr = pdfViewer.getAnnotAuthorityManager();
annotAuthMgr.setAnnotPermissionCallback(function(annot) {
var author = annot.getTitle();
switch(author){
case 'admin':
return Promise.resolve([ANNOTATION_PERMISSION.fully]); // The 'admin' has all permissions
case 'manager':
return Promise.resolve([ANNOTATION_PERMISSION.modifiable]); // The 'manager' has modify permissions
case 'normal-user':
return Promise.resolve([]); // The 'normal-user' has no permission
}
return Promise.resolve(); // Not control permissions over this annotation.
})

## ◆ subscribe()

AnnotationAuthorityManager::subscribe | ( | annot:Annot | ,
|  | callback:(newPermission:AnnotationPermission, annot:Annot) | ,
|  | void |
| ) |  |

Subscribe to monitor an annotation permission changes. Different from PDFViewCtrl.constants.ViewerEvents.annotationPermissionChanged event, this callback will be called after subscribe immediately.

Parameters

  annot | Annot -
  callback | (permission:AnnotationPermission,annot: Annot)=>void -

Returns
  ()=>void - A function used to unsubscribe.

Since
  7.6.0

## ◆ update()

Promise<void> AnnotationAuthorityManager::update | ( | annot |  | ) |

Update specified annotation's permission info.

Parameters

  annot | Annot - The annotation instance

Returns
  Promise<void> -

Since
  7.6.0

## ◆ updateAll()

AnnotationAuthorityManager::updateAll | ( |  | ) |

Update all loaded annotation's permission info.

Returns
  Promise<void>

Since
  7.6.0

@2025 Foxit Software Incorporated. All rights reserved.