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

Slow template form

Explorer ,
Apr 08, 2020 Apr 08, 2020

Copy link to clipboard

Copied

Hello Community.

I have created the attached form. Here you can spawn additional pages using the three grey buttons at the bottom of the first page. There are three hidden templates.

Spawning an new page with one of the three grey buttons, takes too long time until the page is available.

Second problem is, that the page number is not displayed correctly. Third problem is, that switching language does not work on the spawned pages.

Editing the form in acrobat, with all templates are visible, problem 2 and 3 are working correctly.

Can someone help me?

Thanks ind advance.

 

 

 

 

 

TOPICS
Acrobat SDK and JavaScript

Views

638

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 ,
Apr 08, 2020 Apr 08, 2020

Copy link to clipboard

Copied

Suspend the calculation:

 

var expTplt = getTemplate('Template1'); 
this.calculate = false;
expTplt.spawn(numPages,true,false); 
this.calculate = true;

 

May be better when you use layers for the languages.

 

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 ,
Apr 08, 2020 Apr 08, 2020

Copy link to clipboard

Copied

Thanks.

The tip works for the slow spawning pages.

Unfortunately there is still the problem that the page numbers are not correct and the language switching does not work.

 

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 ,
Apr 08, 2020 Apr 08, 2020

Copy link to clipboard

Copied

Where does you set the page numbers?

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 ,
Apr 09, 2020 Apr 09, 2020

Copy link to clipboard

Copied

I found a solution. In the sample pdf of my first comment, there are at the bottom of each page textfields with calculation scripts.

"

var prefix = "";
var re = /(.+\.)(.+)/g;
var res = re.exec(event.target.name);
if (res != null)
{
  prefix = res[1];
}

var dlst = this.getField("DropList1");
var tf = this.getField(prefix + "DocPages");
var xval = parseInt(dlst.value);
var langs = new Array();
var AnzSeiten = this.numPages;
var DieseSeite = event.target.page + 1;

// Sprachtexte
langs[0] = "Seite " + DieseSeite + " von " + AnzSeiten ;

langs[1] = "Page " + DieseSeite + " of " + AnzSeiten ;

langs[2] = "Страница  " + DieseSeite + " из " + AnzSeiten ;

tf.value = langs[xval];

"

This works with the spawned pages.

But with my last problem, I do not find a solution.

Switching the language does not works with the spawned pages. Only the first page will be switsched 😞

 

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 ,
Apr 09, 2020 Apr 09, 2020

Copy link to clipboard

Copied

At validation of the dropdown use this.calculateNow() 

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 ,
Apr 14, 2020 Apr 14, 2020

Copy link to clipboard

Copied

I implemented..

this.calculate = true;
this.calculateNow();

...in the validation user script, but it does not works. I also removed the two commands from the 'key release' action script.

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 ,
Apr 09, 2020 Apr 09, 2020

Copy link to clipboard

Copied

What do you mean by switching language?

Explain in detial

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
Explorer ,
Apr 14, 2020 Apr 14, 2020

Copy link to clipboard

Copied

Hello,

at the top is my pdf file appended.

On the first page is a drop down to select the language. It works with the first page and in Acrobat Pro with all visible templates. But at runtime, after spawning a additional page, the language will be switched only at the first page. The spawned page keeps german language.

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 ,
Apr 15, 2020 Apr 15, 2020

Copy link to clipboard

Copied

After spawning the page you can execute this.calculateNow()

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 ,
Apr 15, 2020 Apr 15, 2020

Copy link to clipboard

Copied

LATEST

Hello,

I found the problem why the visible templates changes the language, but the spawned pages not.

In the text fields, I forgot the following:

var prefix = "";
var re = /(.+\.)(.+)/g;
var res = re.exec(event.target.name);
if (res != null)
{
  prefix = res[1];
}

The spawned pages has the page prefix. If I dont add this prefix to the name in my definition, it cant work.

var tf = this.getField(prefix + "FormTitle1"); // for fields of spawned pages neccessary

🙂

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