Locked output PDF after save

Here is my two line conversion from PPT to PDF:

com.aspose.slides.Presentation pres = new Presentation(source);
pres.save( filename, com.aspose.slides.export.SaveFormat.PDF );

After this call, the pdf exists but is locked and can not be opened or deleted. I am using Apache Tomcat with Netbeans to host this function in a servlet. I can only open the file if I stop Apache Tomcat services.

Aparrently the java com.aspose.slides library is holding a lock on the file but why. Any ideas?

Rick

Hi Rick,

Thanks for your interest in Aspose.Slides.

Actually, the issue is that your program my be hooking the PDF while its safely exits. I suggest you to please use file streams for your PDF saving and closing the file streams once the PDF is generated. Hopefully it will work for you. Please use the following code snippet for your application. For my knowledge, it will be really nice if you may please share some information about your environment, Apache Tomcat setting and how and where you are placing/using Aspose.Slides for Java jar file in your application setup.

java.io.FileInputStream inputStream = new java.io.FileInputStream("/D:/Test.ppt");
java.io.FileOutputStream outputStream = new java.io.FileOutputStream("/D:/Test.pdf");

Presentation pres = new Presentation(inputStream);
pres.save(outputStream, com.aspose.slides.export.SaveFormat.PDF);
outputStream.close();

Thanks and Regards,