Adobe Acrobat Pro XI - Adding Javascript to a PDF

 ̄綄美尐妖づ 提交于 2019-12-06 01:50:06

问题


This may seem like a really novice question, but I have been tearing my hair out all day on this.

I am running the trial version of Adobe Acrobat Professional XI I am looking to add simple JavaScript to a PDF file.

The aim is to have a PDF file, that when opened, pops up with an alert message with Yes and No options. Click Yes, and the alert goes away, leaving the PDF to be read. Click No, and the file closes.

The main trouble I am having is where to write my code. I have used the JavaScript Debugger but it is not very intuitive, and doesn't seem to let me add JavaScript to the file, only run from within the debugger.

All the tutorials I have looked at online show me the code, but not where to write it.


回答1:


In Adobe Acrobat open Tools pane on the right, select JavaScript section and then Document JavaScripts.
Enter a script name and click Add. In the JavaScript editor remove the generated code and add yours:

app.alert({cMsg: "JavaScript action: hello", cTitle: "demo title"});

This code (if not placed in a function) will be executed automatically when the document is opened.



来源:https://stackoverflow.com/questions/24307556/adobe-acrobat-pro-xi-adding-javascript-to-a-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!