Expand my Community achievements bar.

Adobe Form Designer : Disable or hide the command Save As, Save and Print menu

Avatar

Level 1

Dears,

I use the Adobe Form Designer application to create a static pdf document. More precisely, the following version:
Adobe Experience Manager - Forms
Version 6.4.0.20180228.1.932123 Cipher:128-bit
[2003-2018]Adobe Systems Incoporated and its licensors

This pdf document will enable users to fill in fields whose values will then be extracted using a Java application.
On our PDF form, we've inserted a dedicated Save As button to validate mandatory fields.

We'd like to prevent form users from bypassing these validations by using the following toolbar commands or menu options
File --> Save
File --> Save As
File --> Print

To manage validations, I use Shows Events with Scripts, Language Javascripts, Run at Client.

Could you tell me how to disable the toolbar commands and the Save, Save As and Print menu options?
I've used the scripts below but none of them seem to produce the desired result ( example of PDF filein attachment ) :

topmostSubform.#pageSet[0].PageArea1.Artifact::initialize - (JavaScript, client)
 
var printButton = document.querySelector('[name="event__prePrint"]');
        if (printButton) {
            printButton.style.display = "none";  // Hide the button by setting display to none
        }
 
---
 
topmostSubform.#pageSet[0].PageArea1.Artifact::initialize - (JavaScript, client)
 
         // Disable the Save and Save As buttons
        xfa.host.setExportFormat("none"); // This can also help in preventing the form from being saved
        app.menuActions["Save"].enabled = false; // Disable Save
        app.menuActions["SaveAs"].enabled = false; // Disable Save As
        
---
 
 topmostSubform.#pageSet[0].PageArea1.Artifact::preSave - (JavaScript, client)
 
        // Prevent the save action
        xfa.host.cancelAction(); // This cancels the save action
        event.rc = false;
 
----
 
 topmostSubform.#pageSet[0].PageArea1.Artifact::prePrint - (JavaScript, client)
        
    event.rc = false; // Cancels the print operation
        
    var printButton = xfa.resolveNode("event__prePrint");
    if (printButton !== null) {
      printButton.presence = "hidden"; // Hides the print button
    }
5 Replies

Avatar

Level 10

You can't disable the save features of the PDF viewer at all and hiding menu items would only be possible with a script in a so called a folder level which is inpossible to archive from within a form (= document level). More on script contexts here: https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsdevguide/JS_Dev_Contexts.html

 

Printing can be blocked by a script in the prePrint event of any element in the form itself. 

xfa.event.cancelAction = true;

 

Avatar

Level 1

Thank you radzmar ,

I confirm that the given script (to be inserted in the prePrint event) has correctly blocked the print action. Once the user has clicked on the Print menu/command, the system displays the Print cancelled alert.

 

jason2802_0-1728505188284.png

As you mentioned, if it's not possible to disable or hide the Save and Save As menu, would it be possible to block the Save action as is the case with an action on the Print menu/command?

 

 

Avatar

Level 10

No chance. The save command can't be stopped from being executed by design. 

Avatar

Level 1

Thank you again for your feedback. 

It's a real shame. I really want to check that the mandatory fields are validated before the pdf form is saved.
1- Would you have a suggestion (as an alternative to my original idea, which was to disable or hide the Save and Save As menus) so that fields considered as mandatory in the form are checked before allowing the pdf form to be saved?
2- I wonder what purpose the preSave and postSave events serve in the Adobe Form Designer_V6.4.0.20180228 tool?

Thank you again 

Avatar

Level 10

I can't think of another solution, that would help you. The preSave and postSave events are there to execute scripts in that scenarios, like hiding or showing elements or such things.