Skip to content
ComPDF

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub

Add Annotation Tool

You can add annotation tool in the Web PDF Viewer. The following code shows you how to add annotation tools:

javascript
// You can get all tools and set the tool you want.
const tools = docViewer.getToolMap();

const style = docViewer.getTool('ink')
style.borderWidth = 5
UI.registerTool({
  toolName: 'ink1',
  tool: 'ink',
  style
})
UI.setActiveTool('ink1')