Programmatically add content to the editor either by just clicking or dragging some element to the editor

Hey I am exploring what webviewer can do in my project, and came to a problem where I want to programmatically add content (mostly just text) to the editor either by click event or drag&drop event.

1 Like

Hi there,

Do you want to add free-text annotations to the editor, or add actual text content to the editor?

For free-text annotations, you will need to instantiate and add them to the document:

You can then add this code to the event of a button or your drag&drop logic.

For actual text content, you will need to use our Content-edit tool:

From there, click the 'Add Paragraph; tool and either paste in your text content or add your own custom logic there.

Best regards,
Kevin

1 Like

Hello, thanks for the response. I want to do this operation on DOCX files and I want to add actual text content to the editor. I see that the resource you have given is working on PDF files, will it work on DOCX files

1 Like

Hi there,

Please see this guide on editing docx files on WebViewer:

You can try out the editor on our sample showcase as well:

Best regards,
Kevin

1 Like