WebViewer Version: 11.2
Do you have an issue with a specific file(s)? No
Can you reproduce using one of our samples or online demos? No
Are you using the WebViewer server? No
Does the issue only happen on certain browsers? No
Is your issue related to a front-end framework? No
Is your issue related to annotations? Yes
Please give a brief summary of your issue:
In my webviewer I create textbox dinamically as showed below, but when I call annotationManager.selectAnnotation(annot) it does nothing, I get no error in console.
Also clicking on annotation don’t enable dragging or resizing or editing.
How can I do? Thankyou
Please describe your issue and provide steps to reproduce it:
this.instance!.Core.annotationManager.jumpToAnnotation(annot, { isSmoothScroll: true }); // WORKS!
this.instance!.Core.annotationManager.deselectAllAnnotations(); // WORKS!
this.instance!.Core.annotationManager.selectAnnotation(annot); // DOESNT WORKS!
this.instance!.Core.annotationManager.selectAnnotations([annot]); // DOESNT WORKS!
const flags = new this.instance!.Core.Annotations.WidgetFlags();
flags.set(this.instance!.Core.Annotations.WidgetFlags.MULTILINE, false);
flags.set(this.instance!.Core.Annotations.WidgetFlags.REQUIRED, false);
const field = new this.instance!.Core.Annotations.Forms.Field('textBoxField' + index, {
type: 'Tx',
flags: flags,
});
const textBoxWidget = new this.instance!.Core.Annotations.TextWidgetAnnotation(field, {});
textBoxWidget.setHeight(height);
textBoxWidget.setWidth(width);
textBoxWidget.setX(left);
textBoxWidget.setY(top);
textBoxWidget.setPageNumber(page);
textBoxWidget.backgroundColor = new this.instance!.Core.Annotations.Color(221, 221, 221, 0.5);
textBoxWidget.border = new this.instance!.Core.Annotations.Border({
width: 1,
color: new this.instance!.Core.Annotations.Color(0, 0, 0),
});
textBoxWidget.IsClickableOutsideRect = true;
textBoxWidget.Locked = false;
textBoxWidget.LockedContents = false;
textBoxWidget.NoDelete = false;
textBoxWidget.NoMove = false;
textBoxWidget.NoView = false;
textBoxWidget.NoZoom = false;
textBoxWidget.ReadOnly = false;
textBoxWidget.ToggleNoView = false;
this.instance!.Core.annotationManager.getFieldManager().addField(field);
this.instance!.Core.annotationManager.addAnnotation(textBoxWidget);
this.instance!.Core.annotationManager.drawAnnotationsFromList([textBoxWidget]);
1 Like
Hello William,
Thank you for contacting WebViewer Forums.
To select a text widget annotation, this can only be done while in the form builder mode and will not work with a view mode for example. Please see the image below:
Regards,
Luke
1 Like
Dear Luke,
I am encountering an issue specifically within the form section of my WebViewer (Version: 11.2), as shown in the attached images. The problem occurs with fields generated dynamically through the code I have already shared with you. Fields that are manually selected, however, work as expected.
To summarize, when I use the annotationManager.selectAnnotation(annot)
method, nothing happens, and there are no errors shown in the console. Additionally, clicking on an annotation does not allow me to drag, resize, or edit it.
The issue seems to only affect dynamically generated fields. Please see the attached screenshots for further clarification.
Could you please assist me in resolving this issue?
Thank you very much for your help!
Best regards,
William
1 Like
Hello,
any updates on this issue?
Best Regards,
William
1 Like
Dear Luke,
This issue is still unresolved and is blocking our implementation. Dynamically created text fields in form builder mode cannot be selected using annotationManager.selectAnnotation(annot)
, nor can they be dragged, resized, or edited. Manually added fields work fine.
There are no errors in the console, making it difficult to debug. Could you please provide a solution or workaround?
Looking forward to your urgent response.
Best regards,
William
1 Like
Hello William.
Thank you for your reply.
As described in my initial reply, the form field creation mode needs to be enabled before you can edit/select the widget. Can you make sure this is on? For example:
const formFieldCreationManager = annotationManager.getFormFieldCreationManager()
formFieldCreationManager.startFormFieldCreationMode()
It also looks like in your custom UI, you have removed this button which calls the same API.
Please let me know if this works for you. For urgent matters, I would recommend opening a ticket through our support portal here in the future: Submit a ticket : Apryse
Regards,
Luke
1 Like
Dear Kevin,
Thank you for your response. I have followed your suggestion and made the button visible. Here is what I observed:
- With the button enabled, the
selectAnnotation(annot)
command does work for dynamically added fields.
- However, when moving the mouse over these fields, the hand cursor does not appear, and they cannot be selected with a single click, unlike manually created fields.
- The only way to select these dynamically created fields, apart from using
selectAnnotation(annot)
, is through multiple selection using the mouse (dragging a selection box over them).
- I am attaching a video where:
- The first four fields were created dynamically and exhibit the issue.
- The last field at the bottom was created manually using the graphical tool and behaves correctly.
P.S.: I also tried disabling the background transparency of the fields, but this did not make any difference.
Could you help me understand why this difference occurs and if there is a way to make dynamically added fields fully interactive, like manually created ones?
Looking forward to your insights.
Best regards,
William
1 Like
Hello William,
Thank you for your reply.
I am able to reproduce the issue where the fields are not selectable and may be reported as a bug.
There are certain conditions where the field does become selectable again. If you can confirm the following, that would help in our investigation as well:
- Changing the ToolbarGroup from any other (e.g. “View” or “Edit”) to “Form” fixes the issue
- Using the legacy UI seems to also not have this bug
WebViewer(
{
path: '/webviewer/lib',
ui: 'legacy',
Regards,
Luke
1 Like
Dear Luke,
Thank you for your response and for investigating the issue.
I would like to clarify that:
- The issue persists even when using the legacy UI (
ui: 'legacy'
), so this does not seem to be a viable workaround.
- Switching the Toolbar Group from one to another (e.g., from “Form” to “View” and back to “Form”) does not fix the problem.
- I have recorded a video demonstrating both of these cases, where dynamically added fields remain unselectable despite these attempts.
Since this seems to be a reproducible issue, could you confirm if it will be logged as a bug and if there’s any expected workaround or fix?
Looking forward to your response.
Best regards,
William
1 Like