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

Unable to delete pages

Explorer ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

Hello together.

 

I created a form with several pages. The first two pages are the completion instruction. Now I created a button on the first page to delete the first two pages.

In the properties of the button: Action - release mouse button - execute javascript: this.deletePages({nStart: 0; nEnd: 1});

In Acrobat Pro it works properly. In Acrobat Reader DC nothing happens.

I also tried to transfer the delete command into a document script and call this function with the button click, but nothing changed.

Can someone tell me what the problem is?

Thanks in advance.

TOPICS
Acrobat SDK and JavaScript

Views

740

Likes

Translate

Translate

Report

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 3 Correct answers

Community Expert , Jun 18, 2020 Jun 18, 2020

Use the script at "Document Open", not "Page Open".

Likes

Translate

Translate
Community Expert , Jun 19, 2020 Jun 19, 2020

"where can I find 'Document open'?"

 

JavaScript.png

Likes

Translate

Translate
Community Expert , Jun 19, 2020 Jun 19, 2020

You should remove these lines that are useless here:

this.calculate = false;

this.calculate = true;
this.calculateNow();

 

 

You should use these lines instead:

this.delay = true;

this.delay = false;

Likes

Translate

Translate
Community Expert ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

Hi,

For this to work in Acrobat Reader, you need to have enabled form rights ( from the documentation )

The property or method is allowed in Acrobat Professional and Acrobat Standard. It can be accessed in Adobe Reader (version 5.1 or later) depending on additional usage rights that have been applied to the document:

  • ●  F — Requires forms rights

 

you can try and enable this by selecting File -> Save As Other -> Reader Extend PDF.

 

Apparently I am incorrect, that will teach me to believe the documentation.

 

Regards

 

Malcolm

Likes

Translate

Translate

Report

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
Community Expert ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

This adds only form save rights, not the whole form rights.

Likes

Translate

Translate

Report

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
Community Expert ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

Acrobat Reader cannot delete pages, even with Extended Rights enabled.

But this is only true for "real" pages.
If these are pages which have been spawned from a hidden Template Acrobat Reader agrees to delete them.

So the solution is to transform your pages into hidden Templates and spawn a page from each.
So the user of Acrobat Reader can delete them on demand.

 

Likes

Translate

Translate

Report

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
Explorer ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

Hello and thanks for the prompt answers.

@ BarleaDC: Bernd is wright. CHanging the rights does not works.

@ JR_Boulay: In principle it works. Thanks. I turned the first two pages into templates and hid them.
Page 3 got from me as page properties - Actions - Open page - the script to spawn the templates. This works too.
But if I now delete the instructions with the button, it works, but afterwards the instructions are spawned again.

What is wrong?

Script:

var expTplt1 = getTemplate('Instruction1');
var expTplt2 = getTemplate('Instruction2');
this.calculate = false;
expTplt2.spawn(0,true,false);
expTplt1.spawn(0,true,false);
this.calculate = true;
this.calculateNow();

 

Thanks in advance
 

Likes

Translate

Translate

Report

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
Community Expert ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

Use the script at "Document Open", not "Page Open".

Likes

Translate

Translate

Report

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
Explorer ,
Jun 19, 2020 Jun 19, 2020

Copy link to clipboard

Copied

Thanks for prompt info. But where can I find 'Document open'?

Likes

Translate

Translate

Report

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
Community Expert ,
Jun 19, 2020 Jun 19, 2020

Copy link to clipboard

Copied

"where can I find 'Document open'?"

 

JavaScript.png

Likes

Translate

Translate

Report

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
Explorer ,
Jun 19, 2020 Jun 19, 2020

Copy link to clipboard

Copied

uweb40795041_0-1592558255138.png

Following your instruction, I get the displayed window. Here I can create my own scripts. But I have no 'Document open' script. Should I create it myself?

Likes

Translate

Translate

Report

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
Community Expert ,
Jun 19, 2020 Jun 19, 2020

Copy link to clipboard

Copied

Create a function, remove the function definition, and enter your code.

Likes

Translate

Translate

Report

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
Explorer ,
Jun 19, 2020 Jun 19, 2020

Copy link to clipboard

Copied

LATEST

🙂

Thank you both for helping. It works.

It takes a long time to spawn the first two pages, but it works. After first time opening the document and spawning these pages, I removed the 'document opne' script and saved the form. If I now open the document the instruction ist still present, but can be deleted.

Likes

Translate

Translate

Report

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
Community Expert ,
Jun 19, 2020 Jun 19, 2020

Copy link to clipboard

Copied

You should remove these lines that are useless here:

this.calculate = false;

this.calculate = true;
this.calculateNow();

 

 

You should use these lines instead:

this.delay = true;

this.delay = false;

Likes

Translate

Translate

Report

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