Continuing my adventure of "Going Paperless", I needed an easy way to encrypt PDF files before I added them to Evernote. To do this, I used the LEADTOOLS PDFFile()
class to add a user password to a file. I created a console application with code to register itself into the Windows Explorer shell. Now I can right click any PDF file and encrypt it with a password. The LEADTOOLS code to do this is very easy; it took me longer to figure out how to edit the registry to add the application to the Windows Explorer context menu then it did to use LEADTOOLS to add the password.
One call got it done:
new PDFFile( fileName, password ) {
SecurityOptions = new PDFSecurityOptions {
UserPassword = newPassword,
EncryptionMode = PDFEncryptionMode.RC128Bit
},
CompatibilityLevel = PDFCompatibilityLevel.PDF15
}.Convert( 1, -1, null );