Search code examples
javascriptpdfadobeacrobatfillable

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


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?


Solution

  • 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.