com.lowagie.text.pdf
public class PdfEncryptor extends Object
Constructor Summary | |
---|---|
PdfEncryptor() |
Method Summary | |
---|---|
static void | encrypt(PdfReader reader, OutputStream os, byte[] userPassword, byte[] ownerPassword, int permissions, boolean strength128Bits) Entry point to encrypt a PDF document. |
static void | encrypt(PdfReader reader, OutputStream os, byte[] userPassword, byte[] ownerPassword, int permissions, boolean strength128Bits, HashMap newInfo) Entry point to encrypt a PDF document. |
static void | encrypt(PdfReader reader, OutputStream os, boolean strength, String userPassword, String ownerPassword, int permissions) Entry point to encrypt a PDF document. |
static void | encrypt(PdfReader reader, OutputStream os, boolean strength, String userPassword, String ownerPassword, int permissions, HashMap newInfo) Entry point to encrypt a PDF document. |
static void | encrypt(PdfReader reader, OutputStream os, int type, String userPassword, String ownerPassword, int permissions, HashMap newInfo) Entry point to encrypt a PDF document. |
static void | encrypt(PdfReader reader, OutputStream os, int type, String userPassword, String ownerPassword, int permissions) Entry point to encrypt a PDF document. |
static String | getPermissionsVerbose(int permissions)
Give you a verbose analysis of the permissions. |
PdfWriter
. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.Parameters: reader the read PDF os the output destination userPassword the user password. Can be null or empty ownerPassword the owner password. Can be null or empty permissions the user permissions strength128Bits true
for 128 bit key length, false
for 40 bit key length
Throws: DocumentException on error IOException on error
PdfWriter
. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.Parameters: reader the read PDF os the output destination userPassword the user password. Can be null or empty ownerPassword the owner password. Can be null or empty permissions the user permissions strength128Bits true
for 128 bit key length, false
for 40 bit key length newInfo an optional String
map to add or change
the info dictionary. Entries with null
values delete the key in the original info dictionary
Throws: DocumentException on error IOException on error
PdfWriter
. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.Parameters: reader the read PDF os the output destination strength true
for 128 bit key length, false
for 40 bit key length userPassword the user password. Can be null or empty ownerPassword the owner password. Can be null or empty permissions the user permissions
Throws: DocumentException on error IOException on error
PdfWriter
. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.Parameters: reader the read PDF os the output destination strength true
for 128 bit key length, false
for 40 bit key length userPassword the user password. Can be null or empty ownerPassword the owner password. Can be null or empty permissions the user permissions newInfo an optional String
map to add or change
the info dictionary. Entries with null
values delete the key in the original info dictionary
Throws: DocumentException on error IOException on error
PdfWriter
. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.Parameters: reader the read PDF os the output destination type the type of encryption. It can be one of ENCRYPTION_RC4_40, ENCRYPTION_RC4_128 or ENCRYPTION_AES128.
Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext userPassword the user password. Can be null or empty ownerPassword the owner password. Can be null or empty permissions the user permissions newInfo an optional String
map to add or change
the info dictionary. Entries with null
values delete the key in the original info dictionary
Throws: DocumentException on error IOException on error
PdfWriter
. The userPassword and the
ownerPassword can be null or have zero length. In this case the ownerPassword
is replaced by a random string. The open permissions for the document can be
AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
The permissions can be combined by ORing them.Parameters: reader the read PDF os the output destination type the type of encryption. It can be one of ENCRYPTION_RC4_40, ENCRYPTION_RC4_128 or ENCRYPTION_AES128. Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext userPassword the user password. Can be null or empty ownerPassword the owner password. Can be null or empty permissions the user permissions values delete the key in the original info dictionary
Throws: DocumentException on error IOException on error
Parameters: permissions the permissions value of a PDF file
Returns: a String that explains the meaning of the permissions value