Copy link to clipboard
Copied
Hey all!
I have a PDF that has a button that duplicates one of the pages. No problems there, it works great. However, if you click the button a few times, then delete any of the duplicated pages, then create a new copy, then problems arise.
Say I have "Page 1" then click the button twice, so now I have "Page 1", "Copy1 of Page 1", and "Copy2 of Page 1"
Now I delete "Copy1 of Page 1"
Now I click the copy page button again.
Instead of creating the expected "Copy3 of Page 1" is creates "Copy2 of Page 1" again.
So, now there are two "Copy2 of Page 1", so when you type something in one of the pages, it changes the text on both "Copy2 of Page 1". That makes sense, but it shouldn't be creating a second "Copy2 of Page 1"
Any ideas why this is happening or how to fix it?
-Andrew
You could add a button to reset the fields on the page. The users won't be able to delete a page if you don't provide a means to delete it. You're able to delete pages in Acrobat, but Reader users won't be able to do the same thing.
Copy link to clipboard
Copied
May be a problem with the JavaScript code at the button.
Copy link to clipboard
Copied
Here is the code. I can't see why it would cause such a problem
var expTplt = getTemplate("Copy_Page");
expTplt.spawn(numPages,true,false);
Copy link to clipboard
Copied
Bernd Alheit​
Ok, I understand it is because if I make 3 pages (so now there are 4) and delete 2 (now 2) the numPages will start at 3. How can I change the field names without basing it on the page numbers, so that they don't duplicate?
Copy link to clipboard
Copied
If you allow the user to delete pages that were previously created by spawning a template, this is a difficult problem to deal with since the renamed field names depend on the page number. Are you able to put a reasonable limit on how many times a user should be allowed to do this?
Copy link to clipboard
Copied
It will make it slightly inconvenient on the user's end, as they'd have to clear the page they want deleted and just replace the previous data with the new data. However, I don't think that is a big issue.
Is there a way that I can just make it so pages can't be deleted at all?
Copy link to clipboard
Copied
You could add a button to reset the fields on the page. The users won't be able to delete a page if you don't provide a means to delete it. You're able to delete pages in Acrobat, but Reader users won't be able to do the same thing.
Copy link to clipboard
Copied
I had thought about the reset button, but hadn't though about the fact this would be viewed in Reader and thus the user can't delete the pages. Thanks for the help 🙂
Find more inspiration, events, and resources on the new Adobe Community
Explore Now