How to convert DOC to PDF and encrypt PDF via command line?

There are two ways to encrypt PDF via command line: setting open passwords and setting owner passwords. An open password is used to prevent unauthorized readers from opening the open password protected PDF file. An owner password is used to prevent readers from editing or change the content of the PDF file. No matter which type of passwords you want to set, you also need to set key length. Moreover, when you set owner passwords, you also need to set permission.

This article will take a command line application of an all-to-all document converter as an example, and show you how to use it to encrypt PDF when convert DOC to PDF via command line. Three steps are required.

1. Download VeryPDF Document Converter

Please download VeryPDF Document Converter, and install it on your computer. This application can be used free for 50 times. As a matter of fact, VeryPDF Document Converter is the professional version of Document Printer. VeryPDF Document Converter is also known as Document Converter Professional or doc Print Pro. It provides both command line version and GUI version. The command line version is an all-to-all document converter. In this article, we only refer to the command line version.

2. Open the command prompt window

Under different systems, different ways may be required to open the command prompt window. For example, if you are in Windows XP, you can do as follows: click Start in the left down corner on the screen, > click Run on the Start menu, > type cmd in the Run dialog box, > and press Enter on the keyboard.

3. Type a command line and press Enter

The last step is to type a command line in the command prompt window and then press Enter. Please refer to the following basic usage:

Usage: doc2pdf [options] <-i input file> [-o output file]

To convert DOC to PDF, you need to add –I and –o before the path of input file and the path of the output file respectively in the command line; to encrypt PDF, you need to add options to the command ine. As we have mentioned, there are two ways to encrypt PDF. To set an open password, you need to add the option to set open password, and the option to set key length. To set an owner password, you need to add three options: the option to set owner password, the option to set key length, and the option to set permission.

Options:

  •    -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 permission=XXX   : set permission to PDF file

Examples:

  •     doc2pdf -s openpwd=docprint -s keylen=0 -s permission=8 -i C:\in.doc -o C:\out.pdf
  •     doc2pdf -s ownerpwd=docprint -s keylen=2 -s permission=4 -i C:\in.doc -o C:\out.pdf
  •     doc2pdf -s openpwd=docprint -s ownerpwd=456 -s keylen=1 -s permission=4 -i C:\in.doc -o C:\out.pdf

To see values of the option parameters, and other options, please visit the homepage of VeryPDF Document Converter. Or you can directly type the path of the executable file and press Enter.

This is how you can convert DOC to PDF and encrypt PDF via command line. Do you think it is helpful? If you have any question, please leave a message.

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

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!