![]() |
||
Home Products Purchase Downloads Demos Forums Blogs Ticket Wiki API Corporate |
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.aspose.pdf.kit.PdfFileSecurity
Represents a class for encrypting or decrypting a Pdf file with owner's or user's password, the owner can change the security setting.
Constructor Summary | |
PdfFileSecurity(java.io.InputStream inputStream,
java.io.OutputStream outputStream)
Initializes an object instance of PdfFileSecurity. |
|
PdfFileSecurity(java.lang.String inputFile,
java.lang.String outputFile)
Initializes an object instance of PdfFileSecurity. |
Method Summary | |
boolean |
changePassword(java.lang.String ownerPassword,
java.lang.String newUserPassword,
java.lang.String newOwnerPassword)
Changes the user password or owner password by owner, keeps the original security settings. |
boolean |
changePassword(java.lang.String ownerPassword,
java.lang.String newUserPassword,
java.lang.String newOwnerPassword,
int privilege,
boolean b128Bits)
Changes the user password or password by owner, allows to reset Pdf documnent security. |
boolean |
decryptFile(java.lang.String ownerPassword)
Decrypts an encrypted Pdf document by owner. |
boolean |
encryptFile(java.lang.String userPassword,
java.lang.String ownerPassword,
int privilege,
boolean b128Bits)
Encrypts Pdf file with userpassword and ownerpassword, sets privileges to access. |
boolean |
setPrivilege(int privilege)
Sets Pdf file security involving assemblying,copying,modifying etc. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PdfFileSecurity(java.lang.String inputFile, java.lang.String outputFile)
inputFile
- String Source input Pdf file.outputFile
- String Output Pdf file.public PdfFileSecurity(java.io.InputStream inputStream, java.io.OutputStream outputStream)
inputStream
- InputStream Input Pdf Stream.outputStream
- OutputStream Output Pdf Stream.Method Detail |
public boolean changePassword(java.lang.String ownerPassword, java.lang.String newUserPassword, java.lang.String newOwnerPassword) throws java.io.IOException, PdfKitException
ownerPassword
- String The owner's password.newUserPassword
- String New user's password.newOwnerPassword
- String New owner's password.
java.io.IOException
PdfKitException
public boolean changePassword(java.lang.String ownerPassword, java.lang.String newUserPassword, java.lang.String newOwnerPassword, int privilege, boolean b128Bits) throws java.io.IOException, PdfKitException
[SampleCode] String inFile = "example1.pdf"; String outFile = "kitOut.pdf"; PdfFileSecurity fileSecurity = new PdfFileSecurity(inFile, outFile); fileSecurity.changePassword("ownerpass", "user", "owner",PdfPrivilege.Copy | PdfPrivilege.Print, true);
ownerPassword
- String Owner's password.newUserPassword
- String New user's password.newOwnerPassword
- String New owner's password.privilege
- int Reset security.b128Bits
- boolean Be 128bits encryption.
java.io.IOException
PdfKitException
public boolean encryptFile(java.lang.String userPassword, java.lang.String ownerPassword, int privilege, boolean b128Bits) throws java.io.IOException, PdfKitException
[SampleCode] String inFile = "example1.pdf"; String outFile = "kitOut.pdf"; PdfFileSecurity fileSecurity = new PdfFileSecurity(inFile, outFile); fileSecurity.encryptFile("userpass", "ownerpass",PdfPrivilege.AllowAll, false);
userPassword
- String User's password.ownerPassword
- String Ownen's password.privilege
- int Set privilege.b128Bits
- boolean Be 128 bits encryption.
java.io.IOException
PdfKitException
public boolean setPrivilege(int privilege) throws PdfKitException, java.io.IOException
[SampleCode] String inFile = "example1.pdf"; String outFile = "kitOut.pdf"; PdfFileSecurity fileSecurity = new PdfFileSecurity(inFile, outFile); fileSecurity.setPrivilege(PdfPrivilege.Assembly |PdfPrivilege.ScreenReaders);
privilege
- int Setting privilege.
PdfKitException
java.io.IOException
PdfPrivilege
public boolean decryptFile(java.lang.String ownerPassword) throws java.io.IOException, PdfKitException
[SampleCode] String inFile = "example1.pdf"; String outFile = "kitOut.pdf"; PdfFileSecurity fileSecurity = new PdfFileSecurity(inFile, outFile); fileSecurity.decryptFile("ownerpass");
ownerPassword
- String Owner's password.
java.io.IOException
PdfKitException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |