// instantiate FielInfo object<o:p></o:p>
com.aspose.pdf.facades.PdfFileInfo fileInfo = new com.aspose.pdf.facades.PdfFileInfo();
// bind source PDF file
fileInfo.bindPdf("c:/pdftest/table_Secured_output.pdf");
// print if source file is password
encrypted
System.out.println("Is document encrypted = " +
fileInfo.isEncrypted());
// determine if the password type for
document is User
if(fileInfo.getPasswordType() ==
com.aspose.pdf.PasswordType.User );
// print password type information
System.out.println("Password
type = "+ fileInfo.getPasswordType() + "
(type = User)");
fileInfo = new
com.aspose.pdf.facades.PdfFileInfo();
fileInfo.bindPdf("c:/pdftest/table_Secured_output.pdf",
"user");
// print if document is encrypted
System.out.println("Document is encrypted = "+fileInfo.isEncrypted());
//determine if the password type for
document is Owner
if(fileInfo.getPasswordType() ==
com.aspose.pdf.PasswordType.Owner );
//print password type information
System.out.println("Password
type = "+ fileInfo.getPasswordType() + "
(type = Owner)");
// print if document has open password
specified
System.out.println("Document has Open Password = "+fileInfo.hasOpenPassword());
//print if document has edit password
specified
System.out.println("Document has Edit Password = "+fileInfo.hasEditPassword());
fileInfo = new
com.aspose.pdf.facades.PdfFileInfo();
fileInfo.bindPdf("c:/pdftest/table_Secured_output.pdf");
//print if document is encrypted
System.out.println("Document is encrypted = "+fileInfo.isEncrypted());
if(fileInfo.getPasswordType() ==
com.aspose.pdf.PasswordType.Inaccessible );
// print password type information
System.out.println("Password
type = "+ fileInfo.getPasswordType() + "
(type = Inaccessible)");
if(fileInfo.hasOpenPassword());
// Document has open password enable
System.out.println("Document
has open password enabled = "+ fileInfo.hasOpenPassword());
try
{
boolean
hasOwnerPassword = fileInfo.hasEditPassword();
System.out.println("When
PasswordType is Inaccessible we can't read HasEditPassword property.");
}
catch (Exception e)
{
// write what we expect
}