This article aims to introduce a method to set PDF password and convert HTM to PDF via. PDF passwords can be basically divided into two types: owner password and user password. The former one can be used to protect PDF files from being copied, edited, and printed. The latter one can be used to protected PDF files from being opened. This article will take owner password as an example to show you how to set PDF password via as you convert HTM to PDF. Three steps are required.
1. Download VeryPDF HTML Converter Command Line
Click VeryPDF HTML Converter Command Line to download it. This command line application is very professional. It can help you preserve the original layout, color, text, graphics, etc. from HTM to PDF. Believe me, it is worth a try.
2. Open the command prompt window
In XP systems, people will open the command prompt in the following way: click Start, > click Run, > type cmd, > click OK. The following may illustrates it more clearly.
3. Type a command line
To set owner password and convert HTM to PDF, you should refer to the basic usage as follows,
htmltools [-ownerpwd <string>] [ -keylen <int>] <HTM file> [<PDF file>]
d:\htmltools\htmltools.exe -ownerpwd "456" -keylen 2 c:\in.htm d:\out.pdf
- d:\htmltools\htmltools.exe is the directory of the executable file named htmltools.
- -ownerpwd "456" specifies 456 as the owner password. –ownerpwd is one of the option parameters which can be used to set PDF password. There is another option which can be used to set open password, which is –openpwd<string>].
- –keylen 2 sets key length to be 128 bit RC4 encryption(Acrobat 6 or higher). If the number is1, the key length should be -keylen 1: 128 bit RC4 encryption (Acrobat 5 or higher).If the number is 0, the key length would be 40 bit RC4 encryption (Acrobat 3 or higher). When you set password, this option, -keylen <int>, must co-occur with the former one.
- c:\in.htm represents the input file.
- d:\out.pdf represents the output file.
After you type a command line, please press Enter. In a few seconds, when you see “result=ok” in the command prompt window, you can open the export PDF file. If you are using Adobe Reader or Adobe Acrobat to open it, you will find a little icon of lock on the left part of the Adobe window. This icon means your PDF is protected by password.