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.
Use the script at "Document Open", not "Page Open".
"where can I find 'Document open'?"
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;
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
Copy link to clipboard
Copied
This adds only form save rights, not the whole form rights.
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.
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
Copy link to clipboard
Copied
Use the script at "Document Open", not "Page Open".
Copy link to clipboard
Copied
Thanks for prompt info. But where can I find 'Document open'?
Copy link to clipboard
Copied
"where can I find 'Document open'?"
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Create a function, remove the function definition, and enter your code.
Copy link to clipboard
Copied
🙂
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.
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;