TextWidgetAnnotation font size not auto shrink in small form field

WebViewer Version: 8.0.1

Is your issue related to annotations? Yes

Please give a brief summary of your issue:
image

widgetAnnot.font = new Annotations.Font();

Like in the above image, when the input exceed the width of field, it should auto shrink to lower font size to show all input, but it didn’t. Do you know why?

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hello,

Hm, I don’t believe what you described is the default behavior. Trying this out with a text field/widget in our viewing sample, the text will simply continue to concatenate to the right. I think you will have to provide more details so that I can reproduce this behavior.

As a side note, you should initialize the font object with the font and size as there are no default values for the object:

new Annotations.Font({ name: 'Helvetica', size: 24, })

https://www.pdftron.com/api/web/Core.Annotations.Font.html#calculatedsize
In the api doc, it shows size default to 0, I think this enable auto shrink feature right?

image
the problem here is there’re some digits placed ouside of my field, need to move cursor to find the left digits.

Thanks for the update!

I tried this out and it is auto-calculating the font size. You might get better accuracy by providing a font name, but ultimately, the text will reach a minimum size and stop. That minimum size is 4.

font-size

Can you check and confirm the size of the text when you reproduce the issue?

1 Like