• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Interactive PDF update time and calculation order

Explorer ,
Jun 26, 2020 Jun 26, 2020

Copy link to clipboard

Copied

I'm looking for strategies to speed up the time it takes for an interactive PDF form to update.  As I added more interactive elements it takes longer for the form to update if something is changed.

 

For example, the "keyboard" wait icon is now on for about 3-5 seconds everytime make an update to a field.

 

I'm wondering if working on calculation order will improve this, but figure it would be more efficient to see if anyone else has had to address this before diving in and playing with calculation order.

TOPICS
Acrobat SDK and JavaScript

Views

598

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 27, 2020 Jun 27, 2020

Yes that what I did in my form I used a button with this.calculateNow() method.

 

And yes  I think the best way is to learn how to do document level scripting and implementing global variables that you can call on and off when needed.  I am not that advanced in javascript though but there are very good example and tutorials in pdfscripting.com.

Votes

Translate

Translate
Community Expert ,
Jun 27, 2020 Jun 27, 2020

Copy link to clipboard

Copied

Hi,

 

I am having the same issue with one of my PDFs. I about 20 pages, most of them with custom calculating spreadhseets.

 

Most definitely you want to set the calculating order, not necessarily to speed up but also to avoid getting any funky results in any of the calculations.

 

As an additional  work around , I read here in the forums, how to use :

 

  • this.calculateNow()
  • and or a combination of this.calculate = true;
  • and this.calculate = false; 

 

 

I distributed the methods above throughout different sections of my PDF.

 

Using conditional statements in such section, like for example, when the user types in a text fiel, I've  included "this.calculate = false" as a custom format script ) which will  stop all the resource intensive calculations. This  allow the users to fill in and continue to  select items from dropdowns and such without the experienced delay(s).

 

And then  setup the calcutions again in another area later in that form, either by use of a button with mouse actions or as a condition that will trigger from another field object.

 

You can see this mentioned with brief examples in the Adobe Acrobat SDK JavaScript API Reference,  Doc methods, page  241.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 27, 2020 Jun 27, 2020

Copy link to clipboard

Copied

Thanks ls_rbls!

I agree with you on calcualtion order, think I have that figured out after some wonky updating.  By the way I am using  v8.1 of the API reference, so calculateNow is on page 277 for me. 🙂

 

I've been using many hidden value holding text fields instead of more extensive custom claculation scripts as it helps me better track the calculations, making sure various fields are sending the right values, etc.  That is Field1A sends a value to Text1 which is then used by Field1B, where I could also have Field1B take the value from Field1A via a custom calcuation script.   I wonder if that is part of the issue, I have well over a hundred such text fields to hold values.

A more specific example, is FieldFinal may = x + y + z, and a Field1 priveds x but this value is output to Text1, and FieldFinal would then get the value for x from Text1, likewise with y, and z....now imagine 50 FinalFields and each getting 4-6 variables. 🙂   Elegant it is not.

 

I beleive all my user interactive fields do some sort of calculation or populate another field.

 

Could this halting calculation be changed into a global (whole document) command?

 

The idea is there are three drop downs up front that basically set up your choices in 90% of the document.  I do notice that the ones that have more code take longer to execute than the others.  As an aside one was up against the javascript code limit of about 879 lines.

 

I'm thinking of a drop down or button, where the user could select to turn all calculations off docuemnt wide.  Make their 3 priamry slections then turn calculations on and force them to run.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 27, 2020 Jun 27, 2020

Copy link to clipboard

Copied

Yes that what I did in my form I used a button with this.calculateNow() method.

 

And yes  I think the best way is to learn how to do document level scripting and implementing global variables that you can call on and off when needed.  I am not that advanced in javascript though but there are very good example and tutorials in pdfscripting.com.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 27, 2020 Jun 27, 2020

Copy link to clipboard

Copied

Thanks again ls_rbls!

Will give this a try. 

 

pdfscritping.com has some very good stuff, it seems though a lot of times it is behind the pay wall...maybe someday I will join but not yet.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 27, 2020 Jun 27, 2020

Copy link to clipboard

Copied

LATEST

You're welcome.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines