Power Power - 1 month ago 5x
Javascript Question

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

Using java script of PDF forms, how to change the digits style (from English to Arabic numbers) of a script-added-field?


digit mapping function for each field:

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")