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

Free Support Forum - aspose.com

Presentation.write() writes a 0 byte sized file?


Our web-app collates, writes a dynamic powerpoint that is about 22-25 slides (size about 3.5 Mb). When a single user logs on and generates, the powerpoint writes without any issues. If multiple users try logging in and generate, it fails specifically when the powerpoint gets written to the outputstream. The code snippet is attached...A zero byte file is written and the servlet throws an exception. We are making sure of the following:

1. no open resources (files/db handles) exist (checked thro a profiler)

2. we are closing all powerpoints that we have read (for collation)

3. Removed the web-layer from the equation and tried calling the generate method using mock objects (same error)

If we redirect to another page and retry the generation, it works??

Also, if we as a single user we generate about 40 powerpoints (around that number), it randomly fails to generate the 41st, though on restarting the server we can generate ppts. 40-75 for e.g.

Any ideas? This is critical for us to deploy it very soon in our customer's environment. I have tried increasing the buffersize on the response object as well..but it is very clear that the output file written is '0' KB (i.e. aspose throws a write error that is caught by the servlet engine).

---- code snippet -----------------------------------------------------------------------------

private synchronized void writeOutput() throws FileNotFoundException, PptWriteException, IOException, Exception

.......(some code)

setPresentationName(m_company.getCompanyname()+ "_" + todaysDate);

//String despath=PropertyDao.getPptDestination();

fosdes=new FileOutputStream(new File(getFinalPresentationFileName()));

logdata.info("Fos " + fosdes.hashCode());

logdata.debug("The number of slides " + m_finalPresentation.getSlides().size());

m_finalPresentation.write(fosdes); --> THIS IS WHERE IT FAILS AND THE SERVLET CATCHES IT


This message was posted using Page2Forum from Aspose.Slides for .NET and Java - Documentation

I think something in your servlet is not thread-safe.
Make sure you don’t access the same presentation objects simultaneously from different threads. If you create presentation only once and send it to different users write it to the byte array buffer and after that send to responce stream as many times as you need instead of calling Presentation.write() method every time.