Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
322 views
in Technique[技术] by (71.8m points)

Convert digits into words with JavaScript in PDF Form

When I use the code as mentioned by Salman in Convert digits into words with JavaScript in my PDF form in Foxit Reader - custom calculation script, it does not work and when I see the console it says :

======== Field : calculate ========
[ Line: 00015 { ReferenceError } ] : document is not defined

What I need to modify in this to get it working in PDF form?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You obviously need to change the code

document.getElementById('number').onkeyup = function () {
    document.getElementById('words').innerHTML = inWords(document.getElementById('number').value);
};

to the equivalent in foxit

Something like

this.getField ("words").value = inWords(this.getField("number").value)

https://www.foxitsoftware.com/blog/how-to-create-forms-that-perform-simple-mathematical-calculations/

https://developers.foxitsoftware.com/kb/article/javascript-pdf-sdk-java/

https://www.foxitsoftware.com/blog/how-to-add-javascript-functionality-to-pdf-forms-without-coding/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...