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

 

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 command is only available in licensed versions of Win2PDF Pro. Contact [email protected] 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.

 

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