Skip to content

PDF Generation Template Editor

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

View on GitHub

Initialize Editing Mode ​

Before editing, you should initialize editing mode. ComPDFKit provides methods to initialize editing mode.

The following code shows you how to initialize the editing mode:

javascript
// Switch the viewer to the content editing toolbar, which starts the editing mode.
instance.UI.setToolbarGroup('toolbarGroup-EditText');

// Or start the editing mode with the content edit manager only.
await documentViewer.getContentEditManager().startContentEditMode();

Add Text Tool ​

To add new text, you can switch to a tool called Tools.ToolNames.ADD_PARAGRAPH. For example:

javascript
instance.UI.setToolMode(Tools.ToolNames.ADD_PARAGRAPH);

Add Image Tool ​

You can switch to the Tools.ToolNames.ADD_IMAGE_CONTENT tool.

javascript
instance.UI.setToolMode(Tools.ToolNames.ADD_IMAGE_CONTENT);