|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.lowagie.text.pdf.PdfEncryptor
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.
Constructor Summary | |
private |
PdfEncryptor()
|
Method Summary | |
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,
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
private PdfEncryptor()
Method Detail |
public static void encrypt(PdfReader reader, OutputStream os, byte[] userPassword, byte[] ownerPassword, int permissions, boolean strength128Bits) throws DocumentException, IOException
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.
reader
- the read PDFos
- the output destinationuserPassword
- the user password. Can be null or emptyownerPassword
- the owner password. Can be null or emptypermissions
- the user permissionsstrength128Bits
- true for 128 bit key length. false for 40 bit key length
DocumentException
- on error
IOException
- on errorpublic static void encrypt(PdfReader reader, OutputStream os, byte[] userPassword, byte[] ownerPassword, int permissions, boolean strength128Bits, HashMap newInfo) throws DocumentException, IOException
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.
reader
- the read PDFos
- the output destinationuserPassword
- the user password. Can be null or emptyownerPassword
- the owner password. Can be null or emptypermissions
- the user permissionsstrength128Bits
- true for 128 bit key length. false for 40 bit key lengthnewInfo
- an optional String
map to add or change
the info dictionary. Entries with null
values delete the key in the original info dictionary
DocumentException
- on error
IOException
- on errorpublic static void encrypt(PdfReader reader, OutputStream os, boolean strength, String userPassword, String ownerPassword, int permissions) throws DocumentException, IOException
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.
reader
- the read PDFos
- the output destinationstrength
- true for 128 bit key length. false for 40 bit key lengthuserPassword
- the user password. Can be null or emptyownerPassword
- the owner password. Can be null or emptypermissions
- the user permissions
DocumentException
- on error
IOException
- on errorpublic static void encrypt(PdfReader reader, OutputStream os, boolean strength, String userPassword, String ownerPassword, int permissions, HashMap newInfo) throws DocumentException, IOException
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.
reader
- the read PDFos
- the output destinationstrength
- true for 128 bit key length. false for 40 bit key lengthuserPassword
- the user password. Can be null or emptyownerPassword
- the owner password. Can be null or emptypermissions
- the user permissionsnewInfo
- an optional String
map to add or change
the info dictionary. Entries with null
values delete the key in the original info dictionary
DocumentException
- on error
IOException
- on error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |