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

Troubleshooting Template Page Security: Seeking Guidance on Hidden Page Options

Participant ,
Jan 16, 2024 Jan 16, 2024

Would like your kind help please, I'm trying hiding whole template pages and giving users the option to choose (By selecting Yes will unhidden pages). It works fine, but when I'm trying to implement security over the document, the function is not working.
Any otherway to do so please?
Thanks a lot

 

TOPICS
Create PDFs , How to , PDF , PDF forms , Security digital signatures and esignatures
1.9K
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
2 ACCEPTED SOLUTIONS
Community Expert ,
Jan 16, 2024 Jan 16, 2024

Show/hide a Template cannot work with Acrobat Reader, you must spawn/delete them.

It's the same for the user, but not for the document creator.


Acrobate du PDF, InDesigner et Photoshoptographe

View solution in original post

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
Community Expert ,
Jan 16, 2024 Jan 16, 2024

What JR says!!  

A document script cannot use the "hidden" template property or move pages. 

But a document script can use the "template.spawn()" function, and it can delete spawned pages. 

 

Search for "Page Template" on this forum and you'll find plenty of posts on this topic.

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

View solution in original post

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
Community Expert ,
Jan 16, 2024 Jan 16, 2024

How are you hiding/showing the template pages?  

Adding either certificate based security or Password secrurity to a PDF does not restrict spawning and deleting template pages. 

 

Templates also work the same for Reader as they do for Acrobat Professional. There are no restrictions. 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
Participant ,
Jan 16, 2024 Jan 16, 2024

Thanks @Thom Parker 
I add the pages as a template and hide them and apply the following action to the tick boxe:

var hasMovedPages = false;

if (event.target.value !== "Off") {
this.getTemplate("Page2").hidden = false;
this.getTemplate("Page3").hidden = false;
this.getTemplate("Page4").hidden = false;
if (!hasMovedPages) {
this.movePage(this.numPages - 1, 4);
this.movePage(this.numPages - 1, 3);
this.movePage(this.numPages - 1, 2);
hasMovedPages = true;
}
} else {
this.getTemplate("Page2").hidden = true;
this.getTemplate("Page3").hidden = true;
this.getTemplate("Page4").hidden = true;
hasMovedPages = false; // Reset the flag if the value is "Off"
}
It work fine until I apply the restrection options showen in the attached figure. Not sure If I'm doing wrong?!

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
Community Expert ,
Jan 16, 2024 Jan 16, 2024

What JR says!!  

A document script cannot use the "hidden" template property or move pages. 

But a document script can use the "template.spawn()" function, and it can delete spawned pages. 

 

Search for "Page Template" on this forum and you'll find plenty of posts on this topic.

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
Participant ,
Jan 16, 2024 Jan 16, 2024

Thanks @Thom Parker and @JR Boulay got the point and I used the following codeon my check box:

if(event.target.value!="Off")
{this.getTemplate("Page1" ).spawn(1, false, false);}
else
{this.deletePages(1);}

Apprecite your help of guiding me on how do I adapt this code to work on multiple pages (e.g., page 2, page 3) while maintaining the same order.

[Update] I guess the following work fine 🙂

if (event.target.value !== "Off") {
this.getTemplate("page1").spawn(1, false, false);
this.getTemplate("page2").spawn(2, false, false);
this.getTemplate("page3").spawn(3, false, false);
} else {
if (numPages > 1) {this.deletePages(1, this.numPages-1);}
}

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
Community Expert ,
Jan 16, 2024 Jan 16, 2024

Show/hide a Template cannot work with Acrobat Reader, you must spawn/delete them.

It's the same for the user, but not for the document creator.


Acrobate du PDF, InDesigner et Photoshoptographe
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
Community Expert ,
Jan 16, 2024 Jan 16, 2024
LATEST

"Apprecite your help of guiding me on how do I adapt this code to work on multiple pages (e.g., page 2, page 3) while maintaining the same order."

Delete all spawned pages and re-spawn the ones you need in the order you want.

A Spawned page is a duplicate of a hidden Template page so filled fields remain filled, and the user won't notice the difference.


Acrobate du PDF, InDesigner et Photoshoptographe
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