Copy link to clipboard
Copied
Hello Community,
I've created an editable PDF form with a button to "Add page" and uses the following javascript:
var a = this.getTemplate("MyTemplate");
a.spawn({nPage: pageNum + 1, bRename: true, bOverlay: false});
The problem is that it copies only the first page (which you created a template of), where I'd rather have to "copy" the current page and content and place it as last page.
My question is: is it possible to create a template of the current/last page (incl. content) and place it in the back of the document?
Thank you in advance.
Kind regards,
JS
Copy link to clipboard
Copied
You can create a template using 'createTemplate()' and then spawn it, but it can only be executed during a batch or console event.
Copy link to clipboard
Copied
Can you tell me how the javascript would look like?
Copy link to clipboard
Copied
But that won't work if the file is used in Reader. It's better to create Templates from all the pages in advance, and then spawn copies from them.
Copy link to clipboard
Copied
Create templates for all pages.
Copy link to clipboard
Copied
The forms stays the same but the content varies.
Use case would be that the user:
- navigates to last page
- presses "Add page"
- edits newly spawned page
- saves document
It's a continuous process, so creating templates is not an option. Unless it's scripted in the mouseclick action of "add page". Something like create template and then directly spawn template or just copy last/current page and place it in the back of the document.
Do you know how to do this?
Copy link to clipboard
Copied
You can only do that if all the users have Acrobat, and you can install a script file on their local computers in advance.
Copy link to clipboard
Copied
Thanks for the replies and clarification!
Copy link to clipboard
Copied
Can templates have more than one page?
Copy link to clipboard
Copied
No.
Copy link to clipboard
Copied
Thank you! 🙂