I would like to create a custom annotation that is inserted by a button outside of the viewer.
Clicking this button should insert a text field annotation that the user can place
where it belongs inside of their contract.
When adding a text widget the default mode is that you can enter text into it but it isn’t draggable or resizable. If you want to make it resizable/draggable you can switch into the form field edit/creation mode, either from the UI by clicking the “Forms” toolbar group header or using the following code:
Is this what you’re looking for? There are potentially other ways of handling this using custom annotations, or temporary annotations and converting them to a form field after but this way is likely the most straightforward.