Slow template form

Explorer ,
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, Create PDFs, How to, PDF forms

Views

96

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
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.

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
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.

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Apr 08, 2020

Copy link to clipboard

Copied

Where does you set the page numbers?

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
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 😞

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Apr 09, 2020

Copy link to clipboard

Copied

At validation of the dropdown use this.calculateNow() 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Apr 09, 2020

Copy link to clipboard

Copied

What do you mean by switching language?

Explain in detial

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Apr 15, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
uweb40795041 AUTHOR LATEST
Explorer ,
Apr 15, 2020

Copy link to clipboard

Copied

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

🙂

Likes

Translate

Translate

Report

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