Freetext Annotation Text padding

How do I put Freetext Annotation text padding?

PDF.js Express Version
7.1.0

Detailed description of issue
There is an issue where the top of the text is cut off.
image

Expected behaviour
I want the text to be padded at the top so that the text is not cut off.

Code snippet
newAnnot.Width = 100;
newAnnot.Height = 30;
newAnnot.X = 10;
newAnnot.Y = 10;
newAnnot.FontSize = ‘20pt’;
newAnnot.TextColor = new Annotations.Color(0, 0, 0);
newAnnot.setPadding(new Annotations.Rect(0, 0, 0, 0));
newAnnot.StrokeThickness = 0;
newAnnot.setContents(‘Textrtrtr테스트중입니다.’);
annotManager.addAnnotation(newAnnot, true);
annotManager.redrawAnnotation(newAnnot);

1 Like

Hi!

You can change the values in ‘setPadding’ to add padding to the top.

newAnnot.setPadding(new Annotations.Rect(0, 0, 0, 50));

You’ll have to increase the height of the annotation as well.

We have some small improvements coming to the freetext annotation in the next patch so this may help with the text getting cut off as well.

Thanks!
Logan