In this article, I will show you how to encrypt PDF by command line under Mac system including Mac OS X v 10.5, 10.6, 10.7 and later versions. The software I use is named as VeryPDF PDF Toolbox Shell for Mac, which can also be used to merge, split, remove page, export page, encrypt, fill PDF form, edit PDF description information, and optimize PDF. Please check more information on software homepage, in the following part, let us check how to use this software.
Step 1. Download PDF Toolbox Shell for Mac
- There are three versions of this software: Mac, Linux and Windows. Please download the correct version according to your computer system. Here I will take the Mac version for examples.
- When downloading finishes, there will be a DMG file, you need to extract it to some folder by double clicking. Then you can find four sub folders: bin folder, text folder, doc folder and lib folder.
Step 2. Encrypt PDF by command line under Mac
- When you use this software, please refer to its usage and examples. Here is the usage for your reference:
pdftoolbox <input files> [options] <-outfile output > - Please open Prompt Windows and then find executable file in bin folder, call it then you can run the conversion.
- When encrypt PDF by this software, please refer to the following command line templates.
pdftoolbox 1.pdf -outfile 1.128.pdf -ownerpassword foopass
By this command line, we can set owner password. When input command line, please input PDF file path at first then input parameter –outfile and last output PDF filepath with password setting.
pdftoolbox 1.pdf -outfile out.pdf -ownerpassword opwd -userpassword upwd
By this command line, we can add both open password and owner password to protect output PDF file.
pdftoolbox 1.pdf -outfile out.pdf -ownerpassword opwd -userpassword upwd -permit printing
By this command line, we can set open password, owner password and disable all permission expect printing ability.
Now let us check related parameters:
-key40bit : set output PDF encryption strength as 40 bits.
-key128bit : set output PDF encryption strength as 128 bits.
-permit <permissions> : permissions are applied to the output PDF only if encryption strength is specified or an owner or user password is given.
printing : allow top quality printing.
lowprinting : allow lower quality printing.
modifycontents : allow modifying contents.
assembly : allow document assembly.
copying : allow copying.
screenreader : allow screenreader.
modifyannot : allow adding annotation.
filling : allow filling interactive PDF form.
allowall : allow all the above permissions and top quality printing.
-ownerpassword : set owner password to output PDF file.
-userpassword : set user password to output PDF file.
By those examples and parameters, you can encrypt PDF under Mac system easily. During the using, if you have any question, please contact us as soon as possible.