Some friend has a doubt that “Can it possible to use VB6.0 code to calling Encrypt PDF exe and passing unique password to adobe pdf file ?”If you also are interested in this question, please read this article.
I use a software named Encrypt PDF v2.3 to add password for PDF file. There two passwords you can apply to a PDF. The first is the owner password. Opening the document with the correct owner password (assuming it is not the same as the user password) allows full (owner) access to the document.This unlimited access includes the ability to change the document’s passwords and access permissions. The second is the user password which allows additional operations to be performed according to the user access permissions specified in the document’s encryption dictionary.
- Downloading Encrypt PDF v2.3
Trying once is better than hearing for many times. Download the package of this software to you computer, unzip it and let it run in your computer. Please remember the detail location of the execution file, then you can input Encrypt PDF v2.3 easily. This is the link for its homepage:http://www.verypdf.com/encryptpdf/index.htm
- Call Encrypt PDF v2.3
You can call a command line application from VB directly form here. Then I will show you the normal way to use this software. Same with other command line software, Encrypt PDF v2.3 needs to run in the Dos Windows. Click the “start” on the left corner of the computer screen, then go to “Run” and input the “cmd” in the blank, the there will bounce the MS dos windows. Call EncryptPDF.exe, then input the command according to the usage and example. eg: EncryptPDF -i c:\sample.pdf -o c:\out.pdf -w owner -u user -l c:\out.log
- Take a example for illustration.
I take a random PDF file for example to show you how to add password for PDF by command line. In this example, I will add both user password and owner password.
C:\Documents and Settings\admin>"C:\Documents and Settings\admin\My Documents\Do
wnloads\encryptpdf_cmd\encryptpdf_cmd_v2.3\encryptpdf.exe" –i E:\2011-9-28\12345
6789.pdf -w owner -u user Encrypt the 'E:\2011-9-28\123456789.pdf' file succeed.
It take a few seconds to finish the adding. As I used the trial version, there will be reminder in the windows. If you use the formal one, then reminder will disappear. Form the picture,we can see that the adding password process is smooth.
- Check the effect.
We can find the 123456789.pdf in the folder E:\2011-9-28. When I try to open it now, I need input the password. From this, we can know the owner password was set successfully. It is not hard to deduce that the user password was set successfully too.
You can call Encrypt PDF v2.3 by VB6.0 in the same way. As there is the free trial version, you can experience it yourself.