Some test text!
Web / Guides / Interacting with tools
DocumentViewer comes with ability to change and use tools within the viewer element. Tools are used to create/interact with annotations, select text, and perform other actions. They are found in the Core.Tools
namespace. Not only are tools used in the default WebViewer setup, they can also be used in your custom viewer .
Although you can instantiate a tool manually, this is typically not necessary as the DocumentViewer comes with some default, initialized tools. You can get one of the tools using the getTool
API and the name that the tool was registered with.
const editTool = documentViewer.getTool('AnnotationEdit');
There is an enumeration, Core.Tools.ToolNames
, that makes this accessing the tools easier.
const editTool = documentViewer.getTool(Core.Tools.ToolNames.EDIT);
When there is an active tool, you can fetch it directly using the getToolMode
API.
const currentTool = documentViewer.getToolMode();
You can call the setToolMode
API to change tools from the DocumentViewer.
documentViewer.addEventListener('documentLoaded', () => {
// Changes to the edit tool on every document load
documentViewer.setToolMode(documentViewer.getTool(Core.Tools.ToolNames.EDIT));
});
Learn more about annotations and the tools that create them!
Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales