最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

PDF JavaScript does not work in Adobe Reader DC but all other Readers - Stack Overflow

programmeradmin1浏览0评论

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

.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.

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

http://www.okeechobeecountytaxcollector./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.

Share Improve this question edited Mar 23, 2017 at 17:14 radiovisual 6,4681 gold badge29 silver badges42 bronze badges asked Feb 21, 2017 at 15:02 David BriertonDavid Brierton 7,39713 gold badges55 silver badges105 bronze badges 8
  • 1 Without a working link to your pdf, this is pure guesswork. – mkl Commented Feb 21, 2017 at 20:37
  • Often people use public google drive or dropbox shares. – mkl Commented Feb 22, 2017 at 15:45
  • Your document is encrypted. Please share the password. – mkl Commented Mar 6, 2017 at 16:35
  • That been said, the JavaScript debugger plains SyntaxError: missing ; before statement 121:Document-Level:CreditCalc and ReferenceError: Loaded is not defined 5:Page:Open – mkl Commented Mar 6, 2017 at 16:36
  • @mkl I am not sure what that means and how to fix it? Any chance you can explain it to me I am new to all this – David Brierton Commented Mar 6, 2017 at 17:28
 |  Show 3 more ments

1 Answer 1

Reset to default 7 +100

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 ply 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 plaining 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.

发布评论

评论列表(0)

  1. 暂无评论