需要更改javascript代码

时间:2018-06-05 07:27:35

标签: javascript

我制作了一个pdf,其中用户应该填写所有信息,然后他将签名或至少会有一些东西,以便其他人可以理解谁已经在该文件中工作。为此,adobe数字签名选项非常好。但是,如果我使用此功能,我必须在每次签名时保存pdf文件。我想避免每次保存。所以我搜索谷歌并找到下面的代码。此代码适用于实时设计人员。我不知道formcalc语言,我对Javascript编码知之甚少。

任何人都可以帮助我使用我的acrobat pro表单下面的代码吗? 谢谢

     form1.page1.Button1::mouseDown - (FormCalc, client)

var vDate = Num2Date(Date(), "DD-MMM-YYYY", "en_IE")

var vTime = Num2Time(Time(), "HH:MM:SS")

vSignTime = Concat(vDate, " at ", vTime)

 form1.page1.Button1::click - (JavaScript, client)

// associate the button with a particular signature field
var vSignatureField = signature01.name.toString(); 

// get time stamp in and SafeCode
var timeIn = signingForm.timeStamp();
var sLetter = signingForm.letter(); 
var sNumber = signingForm.number(); 
var SafeCode = sLetter + "-" + sNumber;

// call signing script
signingForm.sign(SafeCode);

// get time stamp out
var timeOut = signingForm.timeStamp(); 
//console.println("timestamp: " + timeOut);

// check time stamp
if (timeOut != timeIn)
{
    xfa.resolveNode("form1.page1." + vSignatureField).rawValue = "SafeCode sync failure: please apply signature again...";
}
else
{
    // check user credentials and sign if OK
    if (vUser.value == "" || vPass.value == "")
    {
        xfa.resolveNode("form1.page1." + vSignatureField).rawValue = "";
    }

    else 
    {
        if (vUser.value == User1.value && vPass.value == (SafeCode + Pass1.value))
        {
            xfa.resolveNode("form1.page1." + vSignatureField).rawValue = vUser.value + ", approved on " + vSignTime.value; 
        }
        else if (vUser.value == User2.value && vPass.value == (SafeCode + Pass2.value))
        {
            xfa.resolveNode("form1.page1." + vSignatureField).rawValue = vUser.value + ", approved on " + vSignTime.value; 
        }
        else if (vUser.value == User3.value && vPass.value == (SafeCode + Pass3.value))
        {
            xfa.resolveNode("form1.page1." + vSignatureField).rawValue = vUser.value + ", approved on " + vSignTime.value;
        }
        else 
        {
            xfa.resolveNode("form1.page1." + vSignatureField).rawValue = "Invalid signature, contact administration...";
        }
    }

}


 form1.page1.signature01::preSave - (JavaScript, client)

console.println("Password 1 before save is " + Pass1.value); 

Pass1.value = Pass1.value; 

console.println("Password 1 after save is " + Pass1.value); 

0 个答案:

没有答案