cancel
Showing results for 
Search instead for 
Did you mean: 

Put a password in a pdf file

rodrigoa
Champ in-the-making
Champ in-the-making
Hello,

In my workflow I am converting .doc in .pdf using var trans = myDoc.transformDocument("application/pdf"); is there any way to put a password to this .pdf file? or any security that avoids that the file can be saved or printed later?

I appreciate any kind of help.

Thanks,

Rodrigo.
2 REPLIES 2

jpotts
World-Class Innovator
World-Class Innovator
RodrigoA,

I don't know if the PDF Toolkit project can do exactly what you are asking for, but it might be a good place to start.

Jeff

rodrigoa
Champ in-the-making
Champ in-the-making
Jeff,

Thank you for the answer, if you do not mind I would like to ask more questions?

I found a example code and I tried to put into my code, but did not work. Can you look to see if you can help me?

                                        var redactionSite = siteService.getSite("redaction");
               var revisionSite = siteService.getSite("revision");
               var publieesSite = siteService.getSite("publiees");
               var documentLibraryRedaction = redactionSite.getContainer("documentLibrary");
               var documentLibraryRevision = revisionSite.getContainer("documentLibrary");
               var documentLibraryPubliees = publieesSite.getContainer("documentLibrary");
               var formatWordPubliees = documentLibraryPubliees.childByNamePath("Format Word");
               bpm_package.children[0].addAspect("cm:versionable");
               var myDoc = bpm_package.children[0];
                 var targetFile = formatWordPubliees.childByNamePath(bpm_package.children[0].name);
                 var trans = myDoc.transformDocument("application/pdf");   
                 var nameFile = trans.name;
                 trans.addAspect("cm:versionable");
                 var nodeRef = trans.properties["sys:node-uuid"];
                    
                 var signingAction = actions.create("pdf-signature");
                 signingAction.parameters["destination-folder"] = documentLibraryRedaction;
                 signingAction.parameters["visibility"] = "visible";
                 signingAction.parameters["private-key"] = userhome.childByNamePath("keys/keystore.ks");
                 signingAction.parameters["key-type"] = "default";
                 signingAction.parameters["key-password"] = "mypass";
                 signingAction.parameters["reason"] = "Because I need to sign this";
                 signingAction.parameters["location"] = "My Location";
                 signingAction.parameters["width"] = "200";
                 signingAction.parameters["height"] = "100";
                 signingAction.parameters["position"] = "bottomleft";
                 signingAction.parameters["location-x"] = "5";
                 signingAction.parameters["location-y"] = "100";
               signingAction.execute(trans);

I also do not know how to deal with the "signingAction.parameters["private-key"] = userhome.childByNamePath("keys/keystore.ks");"

Thanks in advance,

Rodrigo.