VeryPDF Document Converter (docPrint Pro) is the document converter that can help you convert Office to PDF and encrypt PDF by. Three steps are required to solve your problem.
The first step is to download VeryPDF Document Converter. After you install VeryPDF Document Converter on your computer, you will find that Document Converter contains four programs. The one that can help you is docPrint Pro Command Line, which, in fact, refers to doc2pdf.exe.
The second step is to open the command prompt window. In Windows XP, for instance, you can do as follows: Click Start, click Run on the Start menu, type cmd in the Run dialog box and then press Enter.
The third step is to type aaccording to the basic usage of docPrint Pro Command Line:
doc2pdf [options] <-i Document Files> [-o Output]
There are some options that can be used to encrypt PDF files.
-s openpwd=XXX : set 'open password' to PDF file
-s ownerpwd=XXX : set 'owner password' to PDF file
-s keylen=XXX : key length (40 or 128 bit)
-s keylen=0 : 40 bit RC4 encryption (Acrobat 3 or higher)
-s keylen=1 : 128 bit RC4 encryption (Acrobat 5 or higher)
-s keylen=2 : 128 bit RC4 encryption (Acrobat 6 or higher)
-s permission=XXX : set permission to PDF file
-s permission=3900 : Deny anything
-s permission=4 : Deny printing
-s permission=8 : Deny modification of contents
-s permission=16 : Deny copying of contents
-s permission=32 : No commenting
-s permission=1024 : Deny Assemble
When set PDF open password, you are going to use the following two options: -s openpwd=XXX and -s keylen=XXX. When you plan to set owner password, you are going to need three options: -s ownerpwd=XXX, -s keylen=XXX and -s permission=XXX.
For example, the command line as follows can be used to set an open password when convert Office to PDF:
doc2pdf.exe -s openpwd=abc -s keylen=1 -i D:\in.doc -o E:\out.pdf
For another example, the command line below can be used to set an owner password.
doc2pdf.exe -s ownerpwd=hjk -s keylen=2 -s permission=16 -i D:\in.xls -o E:\out.pdf
Moreover, if you want to set an open password and an owner password at the same time, you can type a command line as the following ones:
doc2pdf.exe -s openpwd=123 -s ownerpwd=321 -s keylen=2 s permission=16 -i D:\in.xls -o E:\out.pdf
doc2pdf.exe -s openpwd=123 -s ownerpwd=321 -s keylen=2 s permission=16 -i D:\*.xls -o E:\*.pdf
After you type a command line, please press Enter.
This is how you can use VeryPDF Document Converter (docPrint Pro) to convert Office to PDF and encrypt PDF by command line. I hope this article is helpful.