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...
|
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...
|
|
| addDestroyHook (...hooks) |
|
| destroy () |
|
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
◆ getPermission()
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]);
case 'manager':
return Promise.resolve([ANNOTATION_PERMISSION.modifiable]);
case 'normal-user':
return Promise.resolve([]);
}
return Promise.resolve();
})
◆ 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
-
- 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