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

Is there any less laggy way of dealing with this?

Guest
Jun 28, 2020 Jun 28, 2020

Copy link to clipboard

Copied

Hello.


Basically, I have 120 fields and I need them to be displayed in groups of 30.

So, there are 4 buttons:

  1. Fields 1 to 30 are visible. The others are hidden.
  2. Fields 31 to 60 are visible. The others are hidden.
  3. Fields 61 to 90 are visible. The others are hidden.
  4. Fields 91 to 120 are visible. The others are hidden.

This works and does exactly what I want, but it is a bit laggy, taking a few seconds for each button to perform its actions.

 

So, I tried to solve this in some way and arrived at the following "solution":
I left the 120 fields hidden, and created new 30 fields to just display the information.
Now, when clicking on the buttons, they do not hide/show, but exchange information between them, thus displaying only the 30 that I want, according to the button that is pressed.

It worked, but it got even more laggy.

And now, I'm out of ideas.


So I come here to ask: Is there any less laggy way of dealing with this?

 

Thanks.

TOPICS
Acrobat SDK and JavaScript

Views

309

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 28, 2020 Jun 28, 2020

Copy link to clipboard

Copied

Are there fix content in the fields or can the user change the content?

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
Guest
Jun 28, 2020 Jun 28, 2020

Copy link to clipboard

Copied

The user can change the content of the 120 fields freely.

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
Guest
Jun 29, 2020 Jun 29, 2020

Copy link to clipboard

Copied

Any ideas?

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 29, 2020 Jun 29, 2020

Copy link to clipboard

Copied

Are you using a script to hide/show fields? If so, then there are a couple of options for setting how fields are hidden and shown that may help. 

A) first, is the delay purely about drawing, or are there any value changes that take place when the fields are shown and hidden. Value changes trigger calculations that may be reducing performance.

B) Next, changing the visibility of sevearl individual fields causes several individual page redraws. There are a few things that can make this a single redraw.

    1) There is a parameter that will delay drawing, "doc.delay". Set this to true before changing visibility, then set to false.

    2) Use group naming on your fields, then just set the group to visible or hidden. You should be doing this anyway, because it makes everything easier to handle.

         See the section on field names here: https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm

    3) Put the fields on an OCG Layer. Then change the visibility of the layer. This is an option available to designers that create forms with InDesign. But it can also be done in Acrobat with a plug-in available here:

https://www.pdfscripting.com/public/programs/downloadsearch.cfm?searchtype=simple&searchmode=cat&key...

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
Guest
Jun 29, 2020 Jun 29, 2020

Copy link to clipboard

Copied

Yes. I'm using a script to hide and show the fields, and I did it in groups, just like you said. And they just hide and show, there is no calculation involved.

I tried to use doc.delay, but was unsuccessful. The button just stopped working.
In this case, I put the script for the button inside a function, which is in the document-level javascript window.

 

Here's what the code for the first button looked like after placing the doc.delay you said:

function aba1() {
doc.delay = true;
this.getField("BP1").display = display.visible;
this.getField("BP2").display = display.hidden;
this.getField("BP3").display = display.hidden;
this.getField("BP4").display = display.hidden;
doc.delay = false;
}

 

 

Is that correct?
After inserting it, the button did not respond at all.

 

About OCG Layer and the plugin you mentioned, I haven't tried it yet, but I will try soon and give you feedback.

 

Many thanks for the reply!

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 29, 2020 Jun 29, 2020

Copy link to clipboard

Copied

Replace "doc" with "this".

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 29, 2020 Jun 29, 2020

Copy link to clipboard

Copied

LATEST

In most Acrobat document scripts, "this" is a pointer to the document object. So, as Try67 states, replace "doc" with "this". In exactly the same way you are using "this" with the "doc.getField()" function.

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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