Free Support Forum - aspose.com

Sending powerpoint in the response object FAILS

hi
I am using aspose slides to generate a powerpoint in my web application.
I need to send the powerpoint to the client in the response object.
However, when i do so…the application fails to write the file, if the generated powerpoint is greater than 5Mb …

I am using the below mentioned code to send the powerpoint in the response

response.setContentType(“application/vnd.ms-powerpoint”);
String companyname=combean.getCompanyname();
String attachment=“Attachment;filename=”+companyname+"_"+user.getFirstname()+" “+user.getLastname()+”.ppt";

response.setHeader(“Content-Disposition”, attachment);
File file = new File(finalPresentationFileName);
fis = new FileInputStream(file);
out = response.getWriter();
int i;
while ((i = fis.read()) != -1) {
out.write(i);
}

response.flushBuffer();


Please reply ASAP.
Thanks

Dear vamsee,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for using Aspose.Slides for JAVA.

Thanks for reporting, we will look into this problem and fix it.

Still waiting for a response…
can someone please help…its critical…
needs to be fixed asap.

That is definitely not a problem of Aspose.Slides. There is something with you code or server settings.
Did you check our Northwind for Java demo? Try to use code from this application.

Hi

I tried the Northwind application,…it is not working for multiple users .
I get a null pointer exception for all users except one…
So if multiple users access the app simultaneously…it is generating the powerpoint for one user at a time

I followed the steps given in the readme file.

Please help…


Which version of Aspose.Slides for JAVA you are using? Try other versions and let me know if problem persists?

Try this code, it is working quite fine here with simultaneous mutiple requests. I have also attached the full sevlet code in a text file. I have used Aspose.Slides for JAVA 1.8.2.0

---------------------------------------------------

try

{

Random rand = new Random();

int randI=rand.nextInt(1000);

//Presentation pres=new Presentation();

response.setContentType("application/vnd.ms-powerpoint");

String companyname="CompanyName";

String attachment="attachment;filename=abc" + randI +".ppt";

response.setHeader("Content-Disposition", attachment);

File file = new File("d:\\downloads\\argument.ppt");

FileInputStream fis = new FileInputStream(file);

PrintWriter out = response.getWriter();

int i;

while ((i = fis.read()) != -1) {

out.write(i);

}

fis.close();

out.close();

}

catch(Exception ex)

{

}

hi

I tried the code u have sent. It works fine when the powerpoint size is less than 5 mb for multiple users.
If the powerpoint size increases beyond 5MB…i am getting the following error when multiple users try to access.

Mar 10, 2008 4:39:06 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet action threw exception
java.lang.OutOfMemoryError: Java heap space


Please suggest …how to fix this.