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

GGNAuthor
Inspiring
December 15, 2022

Does you use several folder level scripts?


Thank you Bernd!

To be honest - I don't even know what "folder level scripts" are.

I enclose the original PDF - before I made any changes, except, that I moved the three fields PLZB, PLZB1 and PLZBB from page 3 to page 2 and made them visible.

I should add, that I'm an insurance expert, not a IT-expert. I build some PDF-Forms many years ago together with an IT-Expert. Unfortunately this guy is not available any more. I got other jobs and a Coworker took over. He did build the enclosed PDF-Form, but he also left the company. So I was asked to do some changes. The PDF-forms will be substituted by a new online-calculator next year, so the company doesn't want to invest in the PDF-forms. First I thought the problems were due to the changes I made, but by now found out that the original form already have had this problem - no idea, why nobody found out before ...  Now I have "den schwarzen Peter" (Bernd, you know ..). 

 

I realized that the calculations, that fail, are functions in "Document Java Script", so I moved them to "Field-Script". That did solve the problem with "Ablauf" Date, but not with the "Tarifzonen". I also  changed the two huge if-then-else scripts in functions PLZ() and PLZ1() to an array and got rit of the redundant calculations in PLZ2() and PLZ21() , but that didn't do the job either.... I will enclose a version of my experiments later on.

 

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.