Skip to main content
Inspiring
December 14, 2022
Answered

Java Script done in Pro, works in Pro and MS-Edge but doesn’t work in Adobe Reader?

  • December 14, 2022
  • 7 replies
  • 21419 views

I have to modify a PDF-form a coworker created some years ago. Two pretty big if-then-else scripts (~ 450 lines) used to work well. And they still work well if you use Acrobat Pro or MS-Edge (sic!), but fail with Adobe Reader.

I’ve changed the huge if-then-else to an array – again, works fine in Pro and Edge – but not in Reader...

Any Idea what might go wrong. Aside from the size it is a simple if-then-else script, nothing special about it. Other JS in this very form work fine with Reader too …

 

Additional Question: Actually the two scripts should be a big one. I thought, when changing to an array I could combine them in a single field. But there seems to be a limit to the number of lines allowed in Acrobat. Though there is no error, values at the end of this array are simply not found …?

Thank you

This topic has been closed for replies.
Correct answer GGN

Thank you all!

I did a lot more reworking on these forms as I planed ... Though I still can't tell where the problems came from. They simply vanished as I worked my way through the form. Well apparantly there was to much ... in the whole form (and still is), but for now they work fine.

 

I still have some questions concerning arrays, but I think I set up a speciel test-form and a separate thread for that next year.

 

I wish you a peaceful Christmas and a good start into the New Year!

 

7 replies

GGNAuthorCorrect answer
Inspiring
December 22, 2022

Thank you all!

I did a lot more reworking on these forms as I planed ... Though I still can't tell where the problems came from. They simply vanished as I worked my way through the form. Well apparantly there was to much ... in the whole form (and still is), but for now they work fine.

 

I still have some questions concerning arrays, but I think I set up a speciel test-form and a separate thread for that next year.

 

I wish you a peaceful Christmas and a good start into the New Year!

 

JR Boulay
Community Expert
December 18, 2022

OK, I found it.

 

The issue is the same with Acrobat Reader, I think you don't see it because the "Show console on errors and message" option is not enabled in the Preferences.

 

 

Acrobate du PDF, InDesigner et Photoshopographe
JR Boulay
Community Expert
December 16, 2022

Can you share (part of) this document?

It would be easier to analyze it.

Acrobate du PDF, InDesigner et Photoshopographe
GGNAuthor
Inspiring
December 16, 2022

@JR Boulay  I did alreay share the document. It's in my Post from 15.12.2022 - too bad, this forum doesn't show timestamp ... well, the one starting: "Thank you Bernd!"

JR Boulay
Community Expert
December 15, 2022

You must check the value of the "Product" column for all methods and properties used in your scripts.

Some cannot be used in Reader:

https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/index.html#table-quick-key

 

You should know that the values F, C and S are now equivalent to "All" because these Rights are no longer required since Reader XI.

 

Acrobate du PDF, InDesigner et Photoshopographe
GGNAuthor
Inspiring
December 15, 2022

Thank you JR! But I'm lost ... I gues it's a problem of size, rather the a specific method, but I couldn't find any information about size-limitations. But of course I didn't work my way through all this information...

try67
Community Expert
December 14, 2022

What exactly happens when you use it in Reader? Is there an error message?

GGNAuthor
Inspiring
December 15, 2022

@try67 There is no error message. The field simply does not calculate (Keeps blank if you start with an empty form, value doesn’t change if you start with a form that was calculated in Pro before).

If you activate “Show Console on errors …” The Debugger says: “ReferenceError: ... in not defined”

I enclose some Screenshots and the corresponding JS.

Ablauf.js calculates the date in ProCalcOkay

PLZB_VarBD.js = 22

PLZB1_VarBD.js = 42

 

@Bernd AlheitWell, I'll try to get allowance from my boss to upload the whole documnet

try67
Community Expert
December 15, 2022

These error messages have nothing to do with the code you posted. They are from the calculation event of a field where you selected field names that do not exist. They probably existed when you set it up, but then you renamed them, or removed them, and didn't update the calculation. It should produce the same result in Acrobat, by the way. Maybe you don't have the option to show the Console on errors enabled there, though. If you could share the actual file with us that would be very helpful.

Bernd Alheit
Community Expert
December 14, 2022

Can you share the form?

Bernd Alheit
Community Expert
December 14, 2022

For the scripts use you the internal or a external editor?

GGNAuthor
Inspiring
December 14, 2022

External editor (internal editor can handle only small scripts). Does it make a difference?

BTW: As you might have realized, I have posted this problem in Acronaut forum too. Since I got some helpful tips there, but not a real solution, I’ve tried this forum too.