We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Pptx document problem

I have faced with following problem:
When saving pptx file as OutputStream - file is saved in the manner, that would require its repair, when loading into PowerPoint 2010 (win7).
Though there are no problems with file when saving providing fileName.
To summurize, how to reproduce problem:
1)open pptx document with library
2)save document as pptx using outputstream function overload.

To save your development team some time:
I ran some tests: unarchived files from broken pptx into separate folder and then put them back into zip archive and renamed back to pptx - and it resolved problem. Based on that I would suggest that problem is that in the way result file is zipped. Moreover I created snippet that just loads ‘corrupted’ file and saves it back - and this new document opens without warnings.
There are no problems with content of pptx as far as I can tell; the problem seems to be how it is archived ( for some reason Power Point has some problems loading such zipped pptx).

It’s not a document specific problem, since I had the same results with other my test pptx files.

Decided to provided with all the information you might possibly need:
1) find attached file.zip with 4 files: original files and 2 results of library saving. Problematic file is modified_stream_test2.pptx. 4th file is created just by reopening problematic file, which is generated by library and saving it back on disk. And as you may assure it opens without ‘repair’ request.
2) screenshot of opening file with powerpoint 2010.
3) below is snippet of code I use to generate those 4 files.
Below is test code that I use, if you req

License license = new License();

final String fileName = “test2.pptx”;
final String inputFileName = PATH_TO_FILES + fileName;
final String outputFileName = PATH_TO_FILES + “modified_stream_” + fileName;
InputStream inputStream = new FileInputStream(inputFileName);
OutputStream outputStream = new FileOutputStream(outputFileName);
PresentationEx presentation = new PresentationEx(PATH_TO_FILES + fileName);
presentation.save(PATH_TO_FILES + “modified_file_” + fileName, SaveFormat.Pptx);
PresentationEx presentationStream = new PresentationEx(inputStream);
presentationStream.save(outputStream, SaveFormat.Pptx);

WrapperZipinputStream zipInputStream = new WrapperZipinputStream(new FileInputStream(outputFileName));
ZipOutputStream zipOutputStream = new ZipOutputStream(new FileOutputStream(PATH_TO_FILES + “\modified_after_library_” + fileName));
ZipEntry entry;
while ((entry = zipInputStream.getNextEntry()) != null)
zipOutputStream.putNextEntry(new ZipEntry(entry.getName()));
byte[] buffer = new byte[1024];
int readBytes = 0;
while ((readBytes = zipInputStream.read(buffer)) > 0)
zipOutputStream.write(buffer, 0, readBytes);

I hope that your development team would resolve it quickly. In our production code we use streams only for transferring files and therefore I need it to work correctly. For now I plan to imbed workaround, which I have mentioned, into our code, since I do realize that you won’t be fixing it nearest couple of weeks.
Let me know if you need anything: i would gladly share any details with you.
Thanks in advance

Hi Andrey,

Thanks for sharing the details. I have observed the issue shared by you and have been able to reproduce the issue specified. An issue with ID SLIDESJAVA-33679 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESJAVA-33679) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.


I am running into the same issue, using the lastest release of Apose.Slides for Java. Here is the snippet that I used:

try {
InputStream pptxTemplateFile = getFile(“tempalte.pptx”);
template = new PresentationEx(pptxTemplateFile);

ByteArrayOutputStream outStream = new ByteArrayOutputStream();
byte[] slidesData = null;

template.save(outStream, SaveFormat.Pdf);
slidesData = outStream.toByteArray();
FileUtil.writeDataToTemplocation(“slidesTemplate” ,“pdf”, slidesData);

template.save(outStream, SaveFormat.Pptx);
slidesData = outStream.toByteArray();
FileUtil.writeDataToTemplocation(“slidesTemplate”, “pptx”, slidesData);
} catch (Exception e) {

Did I do anything wrong here? The pdf output has no issue.

Hi Xiangkui,

Thanks for your itnerest in Aspose.Slides.

I have observed the issue shared. Can you pleas share the sample presentaiton along with generated output with us so that I may investigate on my end.

Many Thanks,

Many thanks for your quick response. I figured out the problem – the code use the same outStream for the pdf and pptx output. The output is fine when I used a new OutputStream object for the pptx.

template.save(outStream, SaveFormat.Pdf);
slidesData = outStream.toByteArray();
FileUtil.writeDataToTemplocation(“slidesTemplate” ,“pdf”, slidesData);

outStream = new ByteArrayOutputStream();
template.save(outStream, SaveFormat.Pptx);
slidesData = outStream.toByteArray();
FileUtil.writeDataToTemplocation(“slidesTemplate”, “pptx”, slidesData);

Hi Xiangkui,

This is really appreciable that you have been able to identify and resolve the issue on your end. Please share, if I may help you further in this regard.

Many Thanks,