Skip to Content
Technical Articles
Author's profile photo Cagla Tekdemir

Encrypt Adobeform with Password

Summary : Pdf Viewing with Password Control

Steps :

1. Go to Tcode : SFP

2. Create an Interface

 

3.In the interface, the desired password type is added to the import parameter. – Lv_password

 

4. Then this data is used in the form.

5. Go to Layout and Create a text-field .Then bind lv_password.

 

6. Go to the Initialize event of DATA as shown below

 

Code :

data::initialize – (JavaScript, client)

var password = ”;
var lv_pass = ”;
var passportQuery = false;

lv_pass = USTBOSLUK.TextField2;                                       // Holds the password given in encoding

password = app.response(“Enter password”,”title”,””,true);  // Holds the value entered from the popup

while( passportQuery == false ){
if (password == lv_pass.rawValue)
{
xfa.host.messageBox(“Right password”,”You Know right”,3,0);
passportQuery = true;
}
else
{
app.alert(“Wrong password.You entered:”+password);

password = app.response(“Enter password”,”title”,””,true);

passportQuery = false;
}
}

 

7. Execute :

  • Fill the import parameters when calling the form.
  • Fillable    = ‘N’  Interactive form? – Interactive Form Without Additional Usage Rights
  • Dynamic = ‘X’   Dynamic Form ? – Dynamic Form

 

–>It was not opened because the password entered in the import parameter and the password entered from the popup were not the same.

–> The popup screen will remain open until the password given in the coding matches the password entered from the popup on the screen.

If the passwords match, the PDF will be displayed.

Advantages ;

  • When dynamically calling Adobeform in your code, the password given and the password your user tries must match.
  • The password is not given as hardcode.

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Matthew Billingham
      Matthew Billingham

      Why is the password only 4 characters long?

      Author's profile photo Christian Crusan
      Christian Crusan

      You can disable the client side Javascript execution in Adobe Reader. Then nothing of this code is executed. Some companies even have this disabled per default (security reasons)