PDF JavaScript在Adobe Reader DC中不起作用,但在所有其他Reader中起作用 [英] PDF JavaScript does not work in Adobe Reader DC but all other Readers

查看:202
本文介绍了PDF JavaScript在Adobe Reader DC中不起作用,但在所有其他Reader中起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使pdf与Adobe Reader DC联机工作.

http://www.okeechobeecountytaxcollector.com/Documents/FeeCalculatorRev0909.pdf

所有按钮或功能均无效. (就像您单击汽车,移动房屋"或顶部的那些按钮中的任何一个一样,应该会显示一个下拉菜单.)但是,如果我在其他任何阅读器中打开它,效果都很好.有谁知道我如何能够在Adobe Reader DC中编辑文档以使其正常工作?文档中是否有任何设置,或者您需要更改才能在DC中工作?

我曾尝试将安全性"部分中的设置更改为Acrobat X及更高版本,但这并不能解决该问题.

解决方案

在Adobe DC JavaScript调试器中检查PDF文档时,恐怕会抛出大量语法错误.修复一组语法错误时,会弹出一组全新的语法错误.据我所知(希望有人可以证实这一点)是,旧版本的Adobe中的JavaScript解释器对语言的解释方式没有那么严格,这就是为什么您的表单在旧版本中可用,但是却被停止的原因Acrobat DC中最新的口译员.

当我检查引发错误的JavaScript时,我不仅注意到Adrobat DC确实希望您用分号终止JavaScript语句(您的代码有时会用分号终止),但我同时也发现奇怪的构造,有些让我相信,即使从技术上讲您的表单在旧版本的Acrobat中没有引发任何错误,您也可能会发现这些表单在旧版本中实际上并没有正确地表现.

因此,要纠正这些错误,并使您的表单在Adobe Acrobat DC中工作,您将必须清理所有引发的错误,这意味着必须迁移(更新)编码样式以符合新的严格性要求.在Acrobat DC的运行时中.

例如,当我第一次使用Acrobat DC中的JavaScript调试器打开表单时,列出了以下错误:

    SyntaxError: missing ; before statement
121:Document-Level:CreditCalcException in line 5 of function top_level, script Page-Actions:Page1:Page Open:Action4
ReferenceError: Loaded is not defined
5:Page-Actions:Page1:Page Open:Action4Exception in line 2 of function top_level, script AcroForm:LoadCountyLock:Annot1:OnBlur:Action1
ReferenceError: FormNumber is not defined
2:AcroForm:LoadCountyLock:Annot1:OnBlur:Action1Exception in line 10 of function top_level, script AcroForm:ButtonMonth1.3.0:Annot1:MouseUp:Action2
ReferenceError: MonthsNumber is not defined
10:AcroForm:ButtonMonth1.3.0:Annot1:MouseUp:Action2Exception in line 10 of function top_level, script AcroForm:ButtonMonth1.0.0:Annot1:MouseUp:Action2
Exception in line 10 of function top_level, script AcroForm:ButtonMonth1.1.0:Annot1:MouseUp:Action2
ReferenceError: MonthsNumber is not defined
10:AcroForm:ButtonMonth1.0.0:Annot1:MouseUp:Action2
SyntaxError: missing ; before statement
121:Document-Level:CreditCalc
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
77:AcroForm:DynolistHS:Annot1:MouseUp:Action2
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:
SyntaxError: class is a reserved identifier
56:
SyntaxError: class is a reserved identifier
56:
SyntaxError: class is a reserved identifier
56:
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: missing ; before statement
121:
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
138:AcroForm:DynolistVehicle:Annot1:MouseUp:Action1

请注意您如何遇到所有这些错误,例如:

    SyntaxError: class is a reserved identifier
    SyntaxError: missing ; before statement

这些很好地表明,DC中的新JavaScript解释器正在将JS保持在更高的标准,并使用了诸如class关键字之类的新语言功能,并强加了必须使用分号来终止语句的约定.

当您继续单击PDF时,JavaScript调试器开始以相同的方式抱怨更多错误(缺少分号,未定义的函数等),因此解决一个问题仅揭示了另一只兔子的其他漏洞,然而相同的问题.

因此,我想说的是,更新此表单并为最新版本的DC做好准备的最快方法是浏览脚本并应用一些约定或删节以开始清理语法(以分号终止所有语句,等等). ).清理完语法后,JavaScript解释器很可能会开始查找以前找不到的函数声明(由于它认为语法无效),这将(希望)清除未定义的函数" 错误.

此外,我将做一些常规测试以确保您的表单按预期的方式工作,因为我看到了奇怪的JavaScript,例如从CreditCalc函数获取的此示例:

是否注意到在行123125之间中断?在我看来,这是一种看起来很怪异的JavaScript,从我看到的125行浮动"对象中的代码永远不会受到打击,它只是存在,但永远不会达到目的,这对你来说应该很吓人.

像这样的奇怪结构遍布您的脚本,以及可能潜在地导致意外行为的其他陷阱,例如使用!= 0而不是!== 0.

因此,恐怕这里没有简单的答案,在Acrobat DC允许您运行此表单之前,您可能需要做很多清理工作.

I am unable to get my pdf to work online with Adobe Reader DC.

http://www.okeechobeecountytaxcollector.com/Documents/FeeCalculatorRev0909.pdf

None of the buttons or functionality is working. (Like when you click motorvehicles, or Mobile homes or any of those buttons across the top a drop down of choices is supposed to appear) But if I open in any other reader it works fine. Does anyone know how I may be able to edit the document to work properly in Adobe Reader DC as well? Is there any settings in the document or anything that you have to change for things to work in DC?

I have tried changing the settings in the security section to Acrobat X and later but that did not fix it as well.

解决方案

Upon Inspection of your PDF document in the Adobe DC JavaScript debugger, I am afraid there are just a whole bunch of syntax errors thrown. When you fix one set of syntax errors, a whole new set of syntax errors pop up. From what I can tell (someone can hopefully confirm this) is that the JavaScript interpreters in the older versions of Adobe are less strict about how they interpret the language, which is why your forms are working in the older versions, but are getting stopped by the latest interpreters in Acrobat DC.

When I inspect the JavaScript that is throwing the errors, I am not only noticing that Adrobat DC really wants you to terminate your JavaScript statements with semicolons, (which your code does some of the time), but I am also finding very strange constructs, some that would leave me to believe that even though your forms are technically not throwing any errors in the older versions of Acrobat, you might find that the forms are not actually behaving properly in the older versions.

So, to fix these errors, and get your forms working in Adobe Acrobat DC, you would have to go clean up all the errors being thrown, which means migrating (updating) your coding style to comply with the new level of strictness in the Acrobat DC's runtime.

For example, when I first open your form using the JavaScript debugger in Acrobat DC, I get the following errors listed:

    SyntaxError: missing ; before statement
121:Document-Level:CreditCalcException in line 5 of function top_level, script Page-Actions:Page1:Page Open:Action4
ReferenceError: Loaded is not defined
5:Page-Actions:Page1:Page Open:Action4Exception in line 2 of function top_level, script AcroForm:LoadCountyLock:Annot1:OnBlur:Action1
ReferenceError: FormNumber is not defined
2:AcroForm:LoadCountyLock:Annot1:OnBlur:Action1Exception in line 10 of function top_level, script AcroForm:ButtonMonth1.3.0:Annot1:MouseUp:Action2
ReferenceError: MonthsNumber is not defined
10:AcroForm:ButtonMonth1.3.0:Annot1:MouseUp:Action2Exception in line 10 of function top_level, script AcroForm:ButtonMonth1.0.0:Annot1:MouseUp:Action2
Exception in line 10 of function top_level, script AcroForm:ButtonMonth1.1.0:Annot1:MouseUp:Action2
ReferenceError: MonthsNumber is not defined
10:AcroForm:ButtonMonth1.0.0:Annot1:MouseUp:Action2
SyntaxError: missing ; before statement
121:Document-Level:CreditCalc
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: missing ; before statement
121:
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
77:AcroForm:DynolistHS:Annot1:MouseUp:Action2
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:
SyntaxError: class is a reserved identifier
56:
SyntaxError: class is a reserved identifier
56:
SyntaxError: class is a reserved identifier
56:
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: missing ; before statement
121:
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
56:Document-Level:SVCFees
SyntaxError: class is a reserved identifier
138:AcroForm:DynolistVehicle:Annot1:MouseUp:Action1

Notice how you have all these errors like:

    SyntaxError: class is a reserved identifier
    SyntaxError: missing ; before statement

These are good indicators that the new JavaScript interpreter in DC is holding JS to a higher standard, and using newer language features, like the classkeyword, and imposing a convention that semicolons must be used to terminate statements.

When you continue clicking around the PDF, the JavaScript debugger starts complaining of even more errors in the same manner (missing semicolons, functions that are not defined, etc), so fixing one issue only reveals another rabbit's hole of additional, yet identical issues.

So I would say the fastest route to getting this form updated and ready for the latest version of DC, is to go through your scripts and apply some conventions or linting to start cleaning up the syntax (terminating all statements with semicolons, etc). Once you have cleaned up the syntax, the JavaScript interpreter is likely to start finding the function declarations that it couldn't find before (due to what it was considering an invalid syntax), which will (hopefully) clear up the "function not defined" errors.

Also, I would just do some general testing that your forms work the way you intend, because I am seeing strange JavaScript like this sample taken from the CreditCalc function:

Notice that break between lines 123 and 125? That's weird-looking JavaScript to my eyes, and from what I am seeing the code that sits in that "floating" object on line 125 is not ever going to get hit, it just exists, but won't ever serve a purpose, this should be scary to you.

Strange constructs like that are floating all over your scripts, along with other gotchas that could potentially result in unexpected behaviors, like using != 0 instead of !== 0.

So I'm afraid there is no easy answer here, you will likely have to do a lot of cleanup before Acrobat DC lets you run this form.

这篇关于PDF JavaScript在Adobe Reader DC中不起作用,但在所有其他Reader中起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆