在 Acrobat PDF 表单中使用 java 脚本更改字段数字样式

Changing the field digit style using java script in acrobat PDF forms

使用java PDF 表单的脚本,如何更改脚本添加字段的数字样式(从英文到阿拉伯数字)?

每个字段的数字映射函数:

var eng_digits = ["0","1","2","3","4","5","6","7","8","9","."]
var arb_digits = ["٠","١","٢","٣","٤","٥","٦","٧","٨","٩",","]
function change_digits(num,form){
    var string = "" + num
    var digits = string.split("")
    for (i=0; i<digits.length; i++){
        if(form == "arb"){
            digits[i] = arb_digits[eng_digits.indexOf(digits[i])];
        }else if (form == "eng"){
            digits[i] = eng_digits[arb_digits.indexOf(digits[i])];
        }
    }
    return digits.join("");
}

this.getField("myField").value = change_digits(this.getField("myField").value, "arb")