Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Incorrectly duplicating pages - Seems problem with Acrobat itself

New Here ,
Oct 18, 2016 Oct 18, 2016

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

TOPICS
Acrobat SDK and JavaScript , Windows
585
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Oct 18, 2016 Oct 18, 2016

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.

Translate
Community Expert ,
Oct 18, 2016 Oct 18, 2016

May be a problem with the JavaScript code at the button.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 18, 2016 Oct 18, 2016

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 18, 2016 Oct 18, 2016

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 18, 2016 Oct 18, 2016

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 18, 2016 Oct 18, 2016

George_Johnson​

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 18, 2016 Oct 18, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 18, 2016 Oct 18, 2016
LATEST

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 🙂

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