Password Protected file

Hi,
I have a ppt password protected file and know the password of file. Please guide me how open the password protected file with code using ASPOSE slide and i am using the latest version of ASPOSE slides jar.
password protected file is attached and password is “doc12”.

Regards
Babar Naveed

Hi Babar Naveed,

Thanks for inquiring Aspose.Slides.

I like to share that at the moment the support for accessing the password protected presentation is unavailable in Aspose.Slides for Java 2.9.6 ( The latest available version). However, we are going to release the latest version of Aspose.Slides for Java 3.0.0 in near future, which does include the support for accessing the password protected presentation. The example article for accessing the password protected presentation will also be included as well. The similar implementation is already available in Aspose.Slides for .NET at present. Please visit this documentation link for your kind reference.

Many Thanks,

Please update if this defect has been resolved?


Thanks

Hi Babar Naveed,

I would suggest you to please try using latest version of Aspose.Slides for Java 6.7.1. Please visit this documentation link for your kind reference for sample code to use the desired feature.

Many Thanks,

Hi,


I have evaluated 6.9 version of slides java API and it throws java.lang.IllegalStateException.
But we are expecting some com.aspose.slides.IncorrectPasswordException kind of exception so that we can handle this particular exception on the basis of type check rather than looking for the exception message contents.

Thanks,
Azeem

Hi Azeem,


Please share the sample presentation along with code snippet used on your end. I will investigate the issue further on my end to help you out.

Many Thanks,

Hi,


Please see the attached file and below is the code sample used on my side.

-------------------
Presentation pptPresentation = new Presentation(filePath);
pptPresentation.save(newFileName,SaveFormat.Pdf);
--------------------

Thanks,
Azeem

Hi Azeem,


I have observed the presentation shared and it seems password protected. Please use the sample code shared over this documentation link for your kind reference. Please share if any further help is needed from my side.

Many Thanks,

Hi,


Actually our requirements to identify if a document is password protected or not, we don’t need to set some password with the files, that’s why we are more concerned about the specific Exception type for identifying this or if there is any other help in the API to do this, please let us know.

I have seen the above documentation link which is to guide a user for setting the password as a load option.

Thanks,
Azeem

Hi Azeem,


I like to share that at the moment the defined exception type for loading the password protected protection without providing password is unavailable. However, the generic exception clearly specifies in message about the fact that presentation is encrypted. I have created an issue with ID SLIDESJAVA-33725 as new feature request to provide the mentioned feature support. However, for the time being, you may use the following work around code that serves the purpose for you.

public static void checkPass()
{
try{
String path=“D:\Aspose Data\”;
PresentationEx pres=new PresentationEx(path+“passwordprotected.pptx”);
}
catch(Exception e)
{
String tes=e.getMessage();
if(tes.contains(“Presentation is encrypted”))
{
System.out.println(“Presentation is encrypted…”);
}
}
}

Many Thanks,

Yes a proper invalidPasswordException like Aspose.Words and Aspose.Pdf does would be great!

Hi Azeem,


I like to share that the same functionality is unavailable in Aspose.Slides for .NET as well and it will first be implemented in Aspose.Slides for .NET and will then be ported to Aspose.Slides for Java. We will share the good news with you as soon as the issue will be resolved.

Many Thanks,