|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.qoppa.pdfSecure.PDFSecure
The PDFSecure class provides methods to update security settings on a pdf document.
It can encrypt and decrypt a PDF document as well as set permissions on the document.
| Constructor Summary | |
PDFSecure(InputStream inStream,
IPassword password)
Loads a PDF document from an InputStream. |
|
PDFSecure(String fileName,
IPassword password)
Loads a PDF document from a file. |
|
PDFSecure(URL url,
IPassword password)
Loads a PDF document from a URL. |
|
| Method Summary | |
SignatureField |
addSignatureField(int pageIndex,
String fieldName,
Rectangle2D bounds)
Adds a signature field to a page in the documnet. |
void |
clearSecurity(String currentPermissionsPwd)
Clears the security for this document. |
DocumentInfo |
getDocumentInfo()
Returns a DocumentInfo object containing the information section of a PDF document (author, title, etc.) |
PDFPermissions |
getPermissions()
Returns the permissions object for this document. |
Vector |
getSignatureFields()
Gets a list of signature fields, if any. |
static String |
getVersion()
Returns version string for jPDFSecure. |
boolean |
hasOpenPassword()
Returns a flag indicating whether this document is encrypted with a 'user' password. |
boolean |
hasPermissionsPassword()
Returns a flag indicating whether this document is encrypted with a 'owner' password. |
boolean |
isEncrypted()
Returns a flag indicating whether this document is encrypted. |
void |
saveDocument(OutputStream outStream)
Saves this document to an output stream. |
void |
saveDocument(String fileName)
Saves this document to a file. |
static void |
setAppletKey(String key,
Applet applet)
Method to unlock the production version of the library. |
static void |
setKey(String key)
Method to unlock the production version of the library. |
void |
setSecurity(String newPermPwd,
String newOpenPwd,
PDFPermissions permissions,
String currentPermPwd,
int encryptType)
Sets the security for this document. |
void |
signDocument(SignatureField signField,
SigningInformation signingInfo)
Signs this document using the given signature field. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PDFSecure(String fileName,
IPassword password)
throws PDFException
fileName - Name of the PDF file.password - An object that provides passwords to open the document, leave null if not needed.
When working with documents that have no passwords, the host application should pass null for the
value of this parameter. When documents are known to have passwords, the host application should
pass an instance of the PDFPassword class that can hold a single
password or a list of passwords.
public PDFSecure(InputStream inStream,
IPassword password)
throws PDFException
inStream - InputStream to read the PDF document.password - An object that provides passwords to open the document, leave null if not needed.
When working with documents that have no passwords, the host application should pass null for the
value of this parameter. When documents are known to have passwords, the host application should
pass an instance of the PDFPassword class that can hold a single
password or a list of passwords.
public PDFSecure(URL url,
IPassword password)
throws PDFException
url - Location of the PDF document.password - An object that provides passwords to open the document, leave null if not needed.
When working with documents that have no passwords, the host application should pass null for the
value of this parameter. When documents are known to have passwords, the host application should
pass an instance of the PDFPassword class that can hold a single
password or a list of passwords.| Method Detail |
public void setSecurity(String newPermPwd,
String newOpenPwd,
PDFPermissions permissions,
String currentPermPwd,
int encryptType)
throws PDFException
newPermPwd - The document's new permissions password.newOpenPwd - The document's new open password.permissions - Permission object.currentPermPwd - The current permissions password. This parameter is needed if the
document has a permissions password.encryptType - - The encryption type to use, this value can be either PDFPermissions.ENCRYPTION_RC4 or PDFPermissions.ENCRYPTION_AES.
PDFExceptionpublic boolean hasOpenPassword()
public DocumentInfo getDocumentInfo()
public PDFPermissions getPermissions()
public boolean hasPermissionsPassword()
public void saveDocument(String fileName)
throws IOException,
PDFException
fileName - Name of the file to save the document.
IOException
PDFException
public void saveDocument(OutputStream outStream)
throws IOException,
PDFException
outStream - OutputStream where the document will be written to.
IOException
PDFExceptionpublic static void setKey(String key)
key - Production key.
public static void setAppletKey(String key,
Applet applet)
key - Production key.public static String getVersion()
public boolean isEncrypted()
public void clearSecurity(String currentPermissionsPwd)
throws PDFException
currentPermissionsPwd - The document's current permissions password. This parameter is needed
if the document has a permissions password.
PDFException
public void signDocument(SignatureField signField,
SigningInformation signingInfo)
throws PDFException
signField - The field to use to sign the document.signingInfo - Information required to sign the document.
PDFException
public SignatureField addSignatureField(int pageIndex,
String fieldName,
Rectangle2D bounds)
throws PDFException
PDFSecure.signDocument.
To create an invisible signature field, the bound rectangle should be set to (0,0,0,0) for the bounds.
pageIndex - The index of the page to add the signature field on.fieldName - The name of the new field.bounds - The bounds of the field on the page. (0,0,0,0) indicates that the signature field will be invisible.
PDFExceptionpublic Vector getSignatureFields()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||