Please enable JavaScript to view this site.

Navigation: Developer Information > Command Line Interface

Command Line PDF Encryption

Scroll Prev Top Next More

Encrypt PDF Command Line Format win2pdf-pro-feature

 

win2pdfd.exe encrypt "sourcefile" "destfile" permissions encryptiontype masterpass userpass

 

Where:

 
permissions” is a hexadecimal value as defined here: https://www.win2pdf.com/doc/controllingencryptionoptions.html

It should be set without a preceding 0x. Set permissions to fffffffc to enable all permissions.

 

encryptiontype” is one of “none”, “40”, “128”, “128aes”, or “256aes”. 256aes is recommended.

 

masterpass” is the master or owner password (required).

 

userpass” is the user password, and must be distinct from the “ownerpass”. Set to “” for no user password.

 

This feature requires a licensed version of Win2PDF Pro. Contact us for a time limited evaluation license.

 

If "sourcefile" and "destfile" are the same file, the file is modified in place.

 
To remove encryption, set the encryptiontype to "none" and supply the "masterpass" used when encryption was enabled.

 

Any file names that contain spaces must be enclosed with quotation marks.  The "sourcefile" can be a local file path, or an web address (URL) to an existing PDF.

 

Returns 0 on success, and a Windows system error code on failure.