Hello,
How can i check whether a file(.docx, .rtf, .pdf,.xls, .xlsx etc) is password protected or not?
Can i get the java sample code?
Thanks!
I have observed your comments. For Aspose.Cells, please visit this documentation link to achieve your requirements. We will update you for Aspose.PDF and Aspose.Words soon.
Thanks,
Can I also get sample code for ppt and pptx files?
For Aspose.Slides, you need to load the password protected presentation and InvalidPasswordException is thrown upon loading a password protected presentation. You can then load the presentation in catch block using following code.
public static void TestLoadPassProtected()
{
try
{
Presentation pres = new Presentation("C:\\Aspose Data\\PassPres.pptx");
}
catch (InvalidPasswordException e)
{
LoadOptions options = new LoadOptions();
options.setPassword ("abc");
Presentation pres = new Presentation("C:\\Aspose Data\\PassPres.pptx",options);
boolean isEncrypted= pres.getProtectionManager().isEncrypted();
}
}
In order to verify the protected PDF, I suggest you to please visit this documentation link on your end.