A class which contains PageManipulationOverlay APIs.
⚠ If you want to remove an item in the PageManipulationOverlay, use disableElements.
⚠ If you want to remove an item in the PageManipulationOverlay, use disableElements.
Methods
-
add(operations [, dataElementToInsertAfter])
-
Adds page manipulation operations to the overlay. If a dataElement parameter is provided, the new operations will be added after that element. Otherwise, they will be added at the beginning.
Parameters:
Name Type Argument Description operationsArray.<UI.PageManipulationOverlay.PageManipulationSection> Array of sections to be added, each with its individual operations. dataElementToInsertAfterstring <optional>
The data element of the item to insert after. Can be 'pageRotationControls', 'pageManipulationControls', or a custom data element. If not provided, items will be added at the beginning. Call getItems to see existing items and their data elements. Returns:
The PageManipulationOverlay instance for chaining.Example
WebViewer(...) .then(function (instance) { instance.UI.pageManipulationOverlay.add([ { type: 'customPageOperation', header: 'Custom options', dataElement: 'customPageOperations', operations: [ { title: 'Alert me of selected thumbnail page numbers', img: '/path-to-image', onClick: (selectedPageNumbers) => { alert(`Selected thumbnail pages: ${selectedPageNumbers}`); }, dataElement: 'customPageOperationButton', } ] }, { type: 'divider' } ]); }); -
disableOpeningByRightClick()
-
Disables the Page Manipulation Overlay from opening through right-click on thumbnails
Example
WebViewer(...) .then(function(instance) { instance.UI.pageManipulationOverlay.disableOpeningByRightClick(); }); -
enableOpeningByRightClick()
-
Enables the Page Manipulation Overlay to open through right-click on thumbnails.
Example
WebViewer(...) .then(function(instance) { instance.UI.pageManipulationOverlay.enableOpeningByRightClick(); }); -
getItems()
-
Returns the current array of items in the PageManipulationOverlay
Returns:
The current page manipulation sections in the overlay- Type
- Array.<UI.PageManipulationOverlay.PageManipulationSection>
Example
WebViewer(...) .then(function(instance) { const items = instance.UI.pageManipulationOverlay.getItems(); console.log('Current page manipulation items:', items); }); -
update(operations)
-
Replaces all operations in the PageManipulationOverlay with a new list of operations. To update an individual item, use UI.updateElement.
Parameters:
Name Type Description operationsArray.<UI.PageManipulationOverlay.PageManipulationSection> The list of page manipulation sections that will be rendered in the overlay. If not provided, the overlay will be cleared. - See:
Returns:
The PageManipulationOverlay instance for chaining.Example
WebViewer(...) .then(function (instance) { instance.UI.pageManipulationOverlay.update([ { type: 'customPageOperation', header: 'Print Operations', dataElement: 'customPageOperations', operations: [ { title: 'Print page', img: 'icon-header-print-line', onClick: (selectedPageNumbers) => { console.log('Printing pages:', selectedPageNumbers); }, dataElement: 'printThumbnailPage', } ] }, { type: 'divider' }, { type: 'customPageOperation', header: 'Alert Operations', dataElement: 'customPageOperations-2', operations: [ { title: 'Alert me', img: 'icon-header-print-line', onClick: (selectedPageNumbers) => { alert(`Selected thumbnail pages: ${selectedPageNumbers}`); }, dataElement: 'alertPage', } ] } ]); });
Type Definitions
-
PageManipulationSection
-
Type:
- Object
Properties:
Name Type Argument Description typestring The type of section. Use 'customPageOperation' for custom operations or 'divider' for separators. headerstring <optional>
Header text to be displayed in the UI for this section. Required if type is 'customPageOperation'. dataElementstring <optional>
Unique data element identifier. Required if type is 'customPageOperation'. operationsArray.<UI.PageManipulationOverlay.PageOperation> <optional>
The operations that will be available under this section. Required if type is 'customPageOperation'. -
PageOperation
-
Type:
- Object
Properties:
Name Type Description titlestring Title to be displayed for the operation. imgstring Path to the image to be used as an icon for the operation. onClickfunction Click handler function that receives an array of selected page numbers as a parameter. dataElementstring Unique data element identifier for this operation.