Determine if text content fir annotation size

WebViewer Version: “@pdftron/webviewer”: “^10.5.0”,

I am creating a text annotation where the text content doesn’t fit inside the annotation.
msedge_5Fg64nqAdH
msedge_W52K0Qv3lU

I need to determine if all my content is visible inside the annotation or if the annotation will cut off some part of the content.
If the text content doesn’t fit within the annotation, is there a method to automatically resize only the height of my annotation based on the content height?

So, I need two solutions:

  1. Check if the text content fits the annotation.
  2. Resize the annotation height based on the content height.

For second problem I can use something like

annotation.resize(annotation.getRect())

where annotation will be with updated height. But perhaps there are some simple solution.

Thanks

1 Like

Thank you for posting your question to our forum. We will provide you with an update as soon as possible.

1 Like

Any updates?

With regards.

1 Like

Hi mturenko87,

You could try and use setAutoSizeType for Free Text Annotation. You can find the API here:
https://docs.apryse.com/api/web/Core.Annotations.FreeTextAnnotation.html#setAutoSizeType

You can read more about Free Text Annotations here: Apryse Documentation | Documentation

1 Like