how to change the character spacing in a field of fillable pdf form using javascript

139 views Asked by At

I am modifying a pdf as fillable. I have changed the spacing between the letters in the fields. as one number into a single cell. How to do this with JavaScript? enter image description here

The following code didn't work either

var field = this.getField("field1");
var textField = field.getArray()[0];
textField.textFont.textState.charSpacing = 1.5;

How to do this?

1

There are 1 answers

0
Max Wyss On BEST ANSWER

You would use comb fields, and you set the distance between characters via the field length and the charLimit property.

You also could set the richText property for the field. However, programmatically dealing with richtext fields is a bit messy. Therefore, comb fields are preferred in such a situation.