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.
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.
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.
Copy link to clipboard
Copied
Where does you set the page numbers?
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 😞
Copy link to clipboard
Copied
At validation of the dropdown use this.calculateNow()
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.
Copy link to clipboard
Copied
What do you mean by switching language?
Explain in detial
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.
Copy link to clipboard
Copied
After spawning the page you can execute this.calculateNow()
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
🙂