| java.lang.Object com.lowagie.text.pdf.PdfEncryptor
PdfEncryptor | public class PdfEncryptor (Code) | | This class takes any PDF and returns exactly the same but
encrypted. All the content, links, outlines, etc, are kept.
It is also possible to change the info dictionary.
|
Method Summary | |
public static void | encrypt(PdfReader reader, OutputStream os, byte userPassword, byte ownerPassword, int permissions, boolean strength128Bits) Entry point to encrypt a PDF document. | public static void | encrypt(PdfReader reader, OutputStream os, byte userPassword, byte ownerPassword, int permissions, boolean strength128Bits, HashMap newInfo) Entry point to encrypt a PDF document. | public static void | encrypt(PdfReader reader, OutputStream os, boolean strength, String userPassword, String ownerPassword, int permissions) Entry point to encrypt a PDF document. | public static void | encrypt(PdfReader reader, OutputStream os, boolean strength, String userPassword, String ownerPassword, int permissions, HashMap newInfo) Entry point to encrypt a PDF document. | public static void | encrypt(PdfReader reader, OutputStream os, int type, String userPassword, String ownerPassword, int permissions, HashMap newInfo) Entry point to encrypt a PDF document. | public static void | encrypt(PdfReader reader, OutputStream os, int type, String userPassword, String ownerPassword, int permissions) Entry point to encrypt a PDF document. | public static String | getPermissionsVerbose(int permissions) Give you a verbose analysis of the permissions. |
encrypt | public static void encrypt(PdfReader reader, OutputStream os, byte userPassword, byte ownerPassword, int permissions, boolean strength128Bits) throws DocumentException, IOException(Code) | | Entry point to encrypt a PDF document. The encryption parameters are the same as in
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 Parameters: os - the output destination Parameters: userPassword - the user password. Can be null or empty Parameters: ownerPassword - the owner password. Can be null or empty Parameters: permissions - the user permissions Parameters: strength128Bits - true for 128 bit key length, false for 40 bit key length throws: DocumentException - on error throws: IOException - on error |
encrypt | public static void encrypt(PdfReader reader, OutputStream os, byte userPassword, byte ownerPassword, int permissions, boolean strength128Bits, HashMap newInfo) throws DocumentException, IOException(Code) | | Entry point to encrypt a PDF document. The encryption parameters are the same as in
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 Parameters: os - the output destination Parameters: userPassword - the user password. Can be null or empty Parameters: ownerPassword - the owner password. Can be null or empty Parameters: permissions - the user permissions Parameters: strength128Bits - true for 128 bit key length, false for 40 bit key length Parameters: newInfo - an optional String map to add or changethe info dictionary. Entries with null values delete the key in the original info dictionary throws: DocumentException - on error throws: IOException - on error |
encrypt | public static void encrypt(PdfReader reader, OutputStream os, boolean strength, String userPassword, String ownerPassword, int permissions) throws DocumentException, IOException(Code) | | Entry point to encrypt a PDF document. The encryption parameters are the same as in
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 Parameters: os - the output destination Parameters: strength - true for 128 bit key length, false for 40 bit key length Parameters: userPassword - the user password. Can be null or empty Parameters: ownerPassword - the owner password. Can be null or empty Parameters: permissions - the user permissions throws: DocumentException - on error throws: IOException - on error |
encrypt | public static void encrypt(PdfReader reader, OutputStream os, boolean strength, String userPassword, String ownerPassword, int permissions, HashMap newInfo) throws DocumentException, IOException(Code) | | Entry point to encrypt a PDF document. The encryption parameters are the same as in
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 Parameters: os - the output destination Parameters: strength - true for 128 bit key length, false for 40 bit key length Parameters: userPassword - the user password. Can be null or empty Parameters: ownerPassword - the owner password. Can be null or empty Parameters: permissions - the user permissions Parameters: newInfo - an optional String map to add or changethe info dictionary. Entries with null values delete the key in the original info dictionary throws: DocumentException - on error throws: IOException - on error |
encrypt | public static void encrypt(PdfReader reader, OutputStream os, int type, String userPassword, String ownerPassword, int permissions, HashMap newInfo) throws DocumentException, IOException(Code) | | Entry point to encrypt a PDF document. The encryption parameters are the same as in
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 Parameters: os - the output destination Parameters: type - the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext Parameters: userPassword - the user password. Can be null or empty Parameters: ownerPassword - the owner password. Can be null or empty Parameters: permissions - the user permissions Parameters: newInfo - an optional String map to add or changethe info dictionary. Entries with null values delete the key in the original info dictionary throws: DocumentException - on error throws: IOException - on error |
encrypt | public static void encrypt(PdfReader reader, OutputStream os, int type, String userPassword, String ownerPassword, int permissions) throws DocumentException, IOException(Code) | | Entry point to encrypt a PDF document. The encryption parameters are the same as in
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 Parameters: os - the output destination Parameters: type - the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext Parameters: userPassword - the user password. Can be null or empty Parameters: ownerPassword - the owner password. Can be null or empty Parameters: permissions - the user permissionsvalues delete the key in the original info dictionary throws: DocumentException - on error throws: IOException - on error |
getPermissionsVerbose | public static String getPermissionsVerbose(int permissions)(Code) | | Give you a verbose analysis of the permissions.
Parameters: permissions - the permissions value of a PDF file a String that explains the meaning of the permissions value |
|
|