Product: Apryse PDFTron
Product Version: 10.8.0
Hello, I used the following code to create a text field with the help of text widget annotation.
WebViewer(...)
.then(instance => {
const { annotationManager, Annotations } = instance.Core;
const { WidgetFlags } = Annotations;
// myBtn is your own custom button
document.getElementById('myBtn').addEventListener('click', () => {
// set flags for multiline and required
const flags = new WidgetFlags();
flags.set('Multiline', true);
flags.set('Required', true);
// create a form field
const field = new Annotations.Forms.Field("some text field name", {
type: 'Tx',
defaultValue: "some placeholder default text value",
flags,
});
// create a widget annotation
const widgetAnnot = new Annotations.TextWidgetAnnotation(field);
// set position and size
widgetAnnot.PageNumber = 1;
widgetAnnot.X = 100;
widgetAnnot.Y = 100;
widgetAnnot.Width = 50;
widgetAnnot.Height = 20;
//add the form field and widget annotation
annotationManager.getFieldManager().addField(field);
annotationManager.addAnnotation(widgetAnnot);
annotationManager.drawAnnotationsFromList([widgetAnnot]);
});
});
But the text field created is not shown in the comments box present in the right side.
Also it disappears when I go to the Forms header tab from the View header tab.
Disappears in the forms tab