Copy link to clipboard
Copied
I've managed to find some javascript to put on a button in a PDF form that duplicates the page (after converting it into a template), but it is unlimited.
How do I set a page limit to that button.
This is the javascript I am using:
var a = this.getTemplate("PDFTemplate");
a.spawn();
I know if I add a number inside the spawn() it will duplicate and add that number of pages.
But I want it to stop adding pages after a certain amount say 3 pages and then the button stops duplicating the form.
Any ideas?
Copy link to clipboard
Copied
Let's say that after you've spawned 3 pages there are 5 pages in the file. In that case, change your code to:
if (this.numPages<5) {
var a = this.getTemplate("PDFTemplate");
a.spawn();
} else app.alert("You may not spawn more copies of this page.",1);
Copy link to clipboard
Copied
That worked perfectly!
many thanks
Find more inspiration, events, and resources on the new Adobe Community
Explore Now