Skip to main content
uweb40795041
Known Participant
June 18, 2020
Answered

Unable to delete pages

  • June 18, 2020
  • 4 replies
  • 2276 views

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.

This topic has been closed for replies.
Correct answer JR Boulay

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;

4 replies

JR Boulay
Community Expert
JR BoulayCommunity ExpertCorrect answer
Community Expert
June 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;

Acrobate du PDF, InDesigner et Photoshopographe
JR Boulay
Community Expert
Community Expert
June 19, 2020

"where can I find 'Document open'?"

 

Acrobate du PDF, InDesigner et Photoshopographe
uweb40795041
Known Participant
June 19, 2020

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?

Bernd Alheit
Community Expert
Community Expert
June 19, 2020

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

JR Boulay
Community Expert
Community Expert
June 18, 2020

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.

 

Acrobate du PDF, InDesigner et Photoshopographe
uweb40795041
Known Participant
June 19, 2020

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
 

Bernd Alheit
Community Expert
Community Expert
June 19, 2020

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

BarlaeDC
Community Expert
Community Expert
June 18, 2020

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

Bernd Alheit
Community Expert
Community Expert
June 18, 2020

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