Expand my Community achievements bar.

SOLVED

Adobe Experience Manager Forms Saveas

Avatar

Level 4

I am facing issue in implementting save/saveas(ok button) button functionality in AEM Form Designer, where as print and reset buttons functionalities are straight forward and easy.

Need help in save/ save as button script.

1 Accepted Solution

Avatar

Correct answer by
Employee

@shyamasundar-ks 

as I thought you have a security related issue.

See Designer Scripting Reference (adobe.com) and look for exportData

There it says

For security reasons, if you provide the first parameter, the exportData method executes only
when performed on certified documents. If you do not provide the first parameter, the document
does not need to be certified and the user is prompted to provide a location and filename.

 

Only the user is prompted option will work OOTB. Certification can only be applied on the rendered PDF and you must have a valid certficate to certify. You can certify with Acrobat Pro (or AEM Forms server).

What is you use case here?

View solution in original post

5 Replies

Avatar

Employee

Hi @shyamasundar-ks,

what kind of issues?

 

Save functionality is restricted by the Acrobat/Reader security module as the save functionality might be used harmfully.

See JavaScript for Acrobat API Reference (adobe.com) and find saveas function. It has a red S for security. This means (quote):
For security reasons, this property or method may be available only during certain events. These
events include batch processing, application start, or execution within the console. (See the
event object for details of the Acrobat events.)
Beginning with Acrobat 7.0, to execute a security-restricted method through a menu event, one
of the following must be true:
o The JavaScript user preferences item Enable Menu Items JavaScript Execution Privileges is
checked.
o The method is executed through a trusted function. For details and examples, see the
app.trustedFunction method.
See Privileged versus non-privileged context for more information.
Note: (Acrobat 6.0 or later) Methods marked with S will execute without restriction in a certified
document provided the certifier’s certificate is trusted for running embedded high
privilege JavaScript and other limitations in the quick bar fields are met

 

Also, if a form is opened in Adobe Reader (vs Acrobat Pro) you will require "Reader Extensions" to be applied to the PDF so that exporting of data is allowed.

 

@Kosta_Prokopiu1 : Thanks for the reply.

form1.#subform[0].Button1::click - (FormCalc, client)
$host.exportData("",1);
xfa.host.exportData("",1);

shyamasundarks_2-1630570122588.png

shyamasundarks_3-1630570174208.png

I have enabled  Enable Menu Items JavaScript Execution Privileges.

Still getting the same security settings error.

 

Avatar

Correct answer by
Employee

@shyamasundar-ks 

as I thought you have a security related issue.

See Designer Scripting Reference (adobe.com) and look for exportData

There it says

For security reasons, if you provide the first parameter, the exportData method executes only
when performed on certified documents. If you do not provide the first parameter, the document
does not need to be certified and the user is prompted to provide a location and filename.

 

Only the user is prompted option will work OOTB. Certification can only be applied on the rendered PDF and you must have a valid certficate to certify. You can certify with Acrobat Pro (or AEM Forms server).

What is you use case here?

@Kosta_Prokopiu1 

I dont have the valid certificate so I am trying with second approach.

form1.#subform[0].saveas::click - (FormCalc, client)
xfa.host.exportData("", 0) //FormCalc

 form1.#subform[0].saveas::click - (JavaScript, client)
xfa.host.exportData("",0)//javascriptript

Both of the above approaches are not working.

shyamasundarks_0-1630581450247.png

I am getting this following error,

shyamasundarks_1-1630581517571.png

 

Usecase: I have configured on ok Button in form and click on this button should be able to save the form successfully.

Avatar

Employee

@shyamasundar-ks , I did test this in Acrobat Pro and had no problem, with an empty path/filename the dialog opens.

 

Then I went to a different system where I have Adobe Reader installed. I tried the same thing and it did not work. 

 

I applied Reader Extensions with Acrobat Pro on the PDF to allow saving data. But Reader still rejects it with the same message I see on your debugger.

I did some research and it seems that the exportData method is not working in Adobe Reader even with Reader Extensions applied.

 

I then certified that PDF and applied ReaderExtensions but it still did not work in Adobe Reader. Unfortunately this seems to be the situation also for other people out there.

Kosta