Convert Excel to PDF and set PDF password via command line

VeryPDF Document Converter (docPrint Pro) can help you use command line to set PDF passwords and convert Excel to PDF. With the help of VeryPDF Document Converter (docPrint Pro), you can set either PDF owner passwords or PDF open passwords, or set both types of passwords for your PDF files.

The following will explain how to convert Excel to PDF and set PDF password via command line. Normally three steps would be enough.

You should begin with downloading the command line version of VeryPDF Document Converter (docPrint Pro). VeryPDF Document Converter, also named docPrint Pro, provides both a command line version and a GUI version. You should download the former on by clicking VeryPDF Document Converter. After you install the command line application on your hard disk, you can proceed to the next step. By the way, you can use VeryPDF Document Converter free for 50 times before you buy it.

The second step is to open the command prompt window. Guess most of you must have known about how to do, I would briefly introduce a common way to open it in Windows XP. You should first click Start on the desktop, then click Run on the Start menu. After that, type CMD or cmd in the Run dialog box, and at last, press Enter. When you find the command prompt window on your screen, you can precede to the last step.

The last step is to type a single command line in the command prompt window and press Enter. The basic usage of the executable file contained in the installation folder is doc2pdf [options] <-i Document Files> [-o Output]. The options that can be used to set PDF passwords are:

  1.     -s openpwd=XXX    : set 'open password' to PDF file
  2.     -s ownerpwd=XXX   : set 'owner password' to PDF file
  3.     -s keylen=XXX     : set 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)
  4.     -s permission=XXX : set permission to PDF file
            -s permission=0    : Encrypt the file only
            -s permission=3900 : Deny anything
            -s permission=4    : Deny printing
              …

There are four options for PDF password setting. The first one is for PDF open password setting. The second one is for PDF owner password setting. The third one is for key length setting and it permits three values. The last one is for setting permission to PDF file, and this option permits a lot of values. If you want to see more, please type the directory of the executable file in the command prompt window and press Enter.

If you want to set PDF open passwords, you are going to need the first option and third option. If you want to set owner passwords, you are going to need the second option, the third option and the fourth option above. Anyway, no matter which type of PDF passwords you want to set, when you set PDF passwords, you need to use the option for key length setting. The following are some examples:

"C:\docPrint Pro v5.0\doc2pdf.exe" -s openpwd=123 -s keylen=1 –i D:\in.xls -o E:\out.pdf

"C:\docPrint Pro v5.0\doc2pdf.exe" -s ownerpwd=123 –s keylen=0 -s permission=4 –i D:\in.xls -o E:\out.pdf

"C:\docPrint Pro v5.0\doc2pdf.exe" -s ownerpwd=123 –s keylen=0 -s permission=4 -i D:\*.xls -o E:\*.pdf

The first example can set an open password for a single PDF file converted from an Excel file. The second example can set an owner password for a PDF file converted from an Excel file. The last example can set an owner password for each PDF file converted from multiple Excel files.

These are the three steps you should take to use command line to set PDF password and convert Excel to PDF. Do you think this method is helpful? Do you like to use VeryPDF Document Converter (docPrint Pro) to convert documents via command line? If you have any question, please feel free to ask!

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

This entry was posted in docPrint Pro and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!