Need advice about autosizing for freetext annotations

WebViewer Version: 8.9.0

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:
(Think of this as an email subject)

Autosize properties are not working when creating a freetext annotation programatically

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)

I’m creating and inserting a freetext annotation using this code

const freeText = new this.annotations.FreeTextAnnotation();
            freeText.X = x;
            freeText.Y = y;
            freeText.PageNumber = page;
            // freeText.Width = width;
            // freeText.Height = height;
            freeText.Subject = subject;
            freeText.TextAlign = 'center';
            freeText.StrokeThickness = 0;
            freeText.IsHoverable = true;
            freeText.TextVerticalAlign = 'center';
            freeText.TextColor = new this.annotations.Color(0, 0, 0);
            freeText.setPadding(new this.annotations.Rect(0, 0, 0, 0))
            freeText.FontSize = '12pt';
            freeText.setCustomData('uniqueId', this.uniqueId);

that.annotationManager.addAnnotation(annotation, {autoFocus: false});

this code generates the annotation just fine but width and height are not adjusted to content and i get this

if i uncomment height and width properties it looks like this

this one looks fine but if i change font size it doesn’t change annotation dimensions and that’s my issue, any advice to make this work will be appreciated

Hi renkoha

We’ve added the issue to our backlog to be worked on in the future. We don’t have a timeline for when it will be fixed but if it does get fixed we’ll let you know when it’s available in an experimental build to test out and the estimated official release date. If you have a desired timeline for having this issue fixed please let us know and we’ll do our best to work with you on how this can fit into the release schedule.


Hey, Renkoha

We have it fixed in our latest version, PDFTron Systems Inc. | Nightly, please let us know it works or not