Setting passwords is the most commonly used way to encrypt PDF files. There are two types of passwords: open or user passwords ant owner passwords. Open passwords are often used to restrict the opening of PDF files; the unauthorized users can not open or read an open password protected PDF files. Owner passwords are often used to forbidden modification, print and copy. Without an owner password, the user can only read the file but unable to make any change or copy the file.
VeryPDF HTML Tool provides two versions to help you convert web page to PDF and encrypt PDF. Using the GUI version may be easier for some of you, who get used to graphic user interfaces; those who prefer the command line version can save more time and enhance work efficiency. Both versions are available when you click here. This article will focus on the command line version. If you really want to learn the quickest way to convert web page to PDF and encrypt PDF, please click VeryPDF HTML Tool Command Line to download the command line application right way.
The following are the two steps you need to take to convert webpage to PDF and encrypt PDF via command line.
1. Run the Windows Command Prompt
In windows XP, people usually run the Windows Command Prompt as follows: Click Start, > click Run, > type “cmd”, > click OK.
2. Type a command line
You should type a command line, depending on the basic usage as follows: htmltools [options] <web page> [<PDF file>]
The options that can be used to encrypt PDF are as follows:
- -openpwd <string> : Set 'open password' to PDF file
- -ownerpwd <string> : Set 'owner password' to PDF file
- -keylen <int> : Key length (40 or 128 bit)
- -keylen 0: 40 bit RC4 encryption (Acrobat 3 or higher)
- -keylen 1: 128 bit RC4 encryption (Acrobat 5 or higher)
- -keylen 2: 128 bit RC4 encryption (Acrobat 6 or higher)
- -encryption <int> : Restrictions
- -encryption 0: Encrypt the file only
- -encryption 3900: Deny anything
- -encryption 4: Deny printing
- -encryption 8: Deny modification of contents
- -encryption 16: Deny copying of contents
- -encryption 32: No commenting
- ===128 bit encryption only -> ignored if 40 bit encryption is used
- -encryption 256: Deny FillInFormFields
- -encryption 512: Deny ExtractObj
- -encryption 1024: Deny Assemble
- -encryption 2048: Disable high res. printing
- -encryption 4096: Do not encrypt metadata
When you set passwords, you must define the key length, too. Hence, either the option -ownerpwd <string> or -ownerpwd <string> must co-occur with the option -keylen <int>. In addition, when you set owner password, you can set encryption option too, so the option -encryption <int> should co-occur with the option for setting owner password , too.
For example, to set an open password and convert web page to PDF, you can type a command line as the following one:
d:\htmltools\htmltools.exe -openpwd "lily” -keylen 2 www.google.com c:\out.pdf
To set an owner password and convert web page to PDF, you can type a command line as follows:
d:\htmltools\htmltools.exe -ownerpwd "lily” -keylen 2 –encryption 3900 www.google.com c:\out.pdf
After you type a command line, please click Enter on your keyboard. If you want to get the full version of VeryPDF HTML Tool Command Line, please click full version.