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

Free Support Forum - aspose.com

Problems with 2.2.0 for Java

Hello,

Today I tried upgrading a trial I’m running on a server-side Java application from .slides 2.1.0 to 2.2.0.

Previously things worked ok for .ppt but not .pptx - I got this for a blank and non-blank .pptx:

Caused by: java.lang.ArrayIndexOutOfBoundsException: 109
[obfuscated stack trace omitted]

Now after the upgrade to 2.2.0 (i.e. just replacing jar) .ppt and .pptx fail. For .ppt I get:

Caused by: java.awt.HeadlessException
[obfuscated stack trace omitted]

… and for .pptx I get…

Caused by: java.lang.NegativeArraySizeException
[obfuscated stack trace omitted]

The code is question is this:

Presentation pres = new Presentation(new FileInputStream(new File(path)));
Slide slide = pres.getSlideByPosition(1);
BufferedImage image=slide.getThumbnail(new Dimension((int)pres.getSlideSize().getX(),(int)pres.getSlideSize().getY()));

Any ideas? Am I doing something wrong?

Many thanks,

James

Hi James,

Thanks for your interest in Aspose.Slides.

I have observed and executed the code snippet provided by you using Aspose.Slides for Java 2.2.0 along with Aspose.Metafiles 1.6.1. I have been able to successfully generate the thumbnails and code don't seem to have any problem. Please share your presentation data so that i can further investigate the issue.

We are sorry for your inconvenience,

Thanks… here are the presentations plus the libs in case versions are significant. Sorry about the size, I guess you can delete this zip once downloaded.

You mention Aspose.Metafiles 1.6.1 - is this a prerequisite? It doesn’t seem to be mentioned when setting up Aspose.Slides.

Also, it is significant that JAI was not installed on the test machine, i.e. that only the jar files are used? This approach worked for .ppt files in version 2.1.0

Thanks again,

James

Hi James,

I have worked on given presentation files with provided JAR files. I was able to generate the slide thumbnail of blank.ppt and blank.pptx file. However, exception was thrown in case of test.pptx when its thumbnail was generated.

I also verified the presentations with Aspose.Slides for Java 2.2.0 and yours provided JAR files. I have been successfully able to generate the slide thumbnail of all the given presentation files. The generated thumbnail for PPTX have little rendering problem in terms of pink background appearing. For that a separate issue has already been created in our issue tracking system with issue id 16164. This thread has also been associated with the issue, so that you may be notified automatically, once the issue is resolved. For your kind reference, i have attached the output thumbnails.

Thanks and Regards,

Hi Mudassir,

Thanks for your time on this.

I’m not sure what’s going on here exactly, but I’ve boiled the test down to something that can be run independently of the application server. I’ve attached a java, class & batch file to show what I’m doing. You can run the batch file in the same directory as the files previously sent (although I’ve renamed the “this is my test.pptx” to my_test.pptx).

When I run this test the file blank.ppt works fine, but both .pptx files result in a ArrayIndexOutOfBoundsException with AposeSlides version 2.1.0 and a NegativeArraySizeException with version 2.2.0.

If you can run these tests fine using the batch file, all I can imagine is that the JDK/JRE version is a factor. I’m using jdk1.6.0_18.

Running the batch file I no longer get the java.awt.HeadlessException, but I still get this on the (tomcat) server with Apose.Slides version 2.2.0 despite setting -Djava.awt.headless=true. Note that I do not get this using version 2.1.0. I’ve included the stack trace below as it is not obfuscated in this case.

Caused by: java.awt.HeadlessException
at sun.awt.HeadlessToolkit.getScreenResolution(HeadlessToolkit.java:203)
at com.aspose.slides.TextLayout.measureString(SourceFile:1125)
at com.aspose.slides.TextLayout.layoutText(SourceFile:255)
at com.aspose.slides.TextLayout.(SourceFile:126)
at com.aspose.slides.TextFrame.new(SourceFile:728)
at com.aspose.slides.TextFrame.do(SourceFile:104)
at com.aspose.slides.Rectangle.do(SourceFile:137)
at com.aspose.slides.Slide.getThumbnail(SourceFile:1316)
at com.aspose.slides.Slide.getThumbnail(SourceFile:1195)

I have checked that the headless setting is ok by running:

System.out.println("java.awt.headless = " + System.getProperty(“java.awt.headless”));

Immediately before generating the thumbnail. It outputs:

java.awt.headless = true

Again, thanks for your time on this.

James

By the way, I didn’t include the Apos.Slides 2.2.0 lib used in the test.

As you can see from the batch file I’m using aspose-slides-2.2.0-20100328.jar which was the latest as of yesterday. You just need to put this in the same dir as everything else to run the test.

Thanks,

James

Hi James,

I have observed the batch file as well as the Java file shared by you. Actually, you have used the same code snippet for accessing PPT and PPTX files. The code that you have compiled works only for PPT. The PPTX is a separate library and there is a different code for accessing PPTX files. I have shared the TEST_PPTX.java file for accessing PPTX files and generating their thumbnails. Aspose.Slides for Java 2.1.0 does not completely support thumbnail generation of PPTX files, so for one of given PPTX the thumbnail is not generated. Hope it resolves your query. Please find the attached files for necessary details.

Thanks and Regards,

I see… I didn’t realise there was a separate library!

Thanks,

James

Hi I’m having the same problem as James although I have set headless mode in tomcat I get the headless exception error when generating a ppt(not pptx) file from scratch(not using any template). I’ve been using older versions of the library and I’m now making the modifications to the app to support 2007 format. I already have slides 2.2.0 and metafiles 1.6.1. In my linux box everything works fine but ofcourse I have X installed, but in the server I get this problem. The code for generating the ppt file is the same code I’ve been using with older library. Any help will be appreciated.
Thanks,

Tani

Dear Tani,

Thanks for your interest in Aspose.Slides.

Actually, James faced the problem of Headless Exception owing to the fact that he was trying to access a PPTX file with Aspose.Slides.PPT API. But your case seem to be different as you have no such issue. I need to investigate the issue further and for that please share the PPT file and your code snippet. Please also share some more details about your issue.

Thanks and Regards,

Although the code is not complete by looking at this two classes you can
get a good idea of how I’m using your library. I tried to use 2.1.0 but
get a lot of null pointer exceptions when using pptx which works
perfectly when using 2.2.0. The ppt that would be generated is something
like the one I attach which was created with 2.1.0 The code is part of a web application that runs on tomcat 6.0.18

Dear Tani,

I have observed the code snippet provided by you and it seem to have no problem. Can you please share for sake of my knowledge that you are using the same shared code for generating PPTX file as well or not. If you are using the same code for generation of and PPT and PPTX then things will not work this way as Aspose.Slides.PPT and Aspose.Slides.PPTX are two separate API's. Please share some further information.

Thanks and Regards,

Hi Mudassir,

Here I attach the classes that implement 2007 pptx and the interfaces that both 2003 and 2007 implement. Also I attached the exception that is being thrown by the application as you can see it is in Presentation2003 with is the ppt version. Hope this helps to clarify the problem.
Thanks,

Tani

Hi Mudassir,

In fact, I’m still getting the HeadlessException when I convert a ppt using Slides v2.2.0 and the code shared previously when running in tomcat, even with -Djava.awt.headless=true. The same code run against v2.1.0 in tomcat works ok for the same ppt.

The file I used for the above test is Test.pptx from the previous zip file, but saved as a ppt.

I’m also seeing another issue with the pptx itself. When I generate the thumbnail for the above pptx file using v2.2.0 the image shows fine, but the text is missing. Again, this only happens when running under tomcat. When I run the standalone version as per the zip file the text is rendered fine.

In both cases the code I’m running in tomcat is identical to that in the zip file you attached.

Thanks,

James

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

Caused by: java.awt.HeadlessException
at sun.awt.HeadlessToolkit.getScreenResolution(HeadlessToolkit.java:203)
at com.aspose.slides.TextLayout.measureString(SourceFile:1125)
at com.aspose.slides.TextLayout.layoutText(SourceFile:255)
at com.aspose.slides.TextLayout.(SourceFile:126)
at com.aspose.slides.TextFrame.new(SourceFile:728)
at com.aspose.slides.TextFrame.do(SourceFile:104)
at com.aspose.slides.Rectangle.do(SourceFile:137)
at com.aspose.slides.Slide.getThumbnail(SourceFile:1316)
at com.aspose.slides.Slide.getThumbnail(SourceFile:1195)



Hi James and Tani,

I am sorry for the inconvenience that you people have encountered.

I have discussed the issue with our development team and it has been added as an issue in our issue tracking system with issue ID 16690. Our development team will now look into the issue and resolve it. This thread has also been linked with the issue so that you may be automatically notified once the issue is resolved. Hopefully the fix for the issue will be available in next release of Aspose.Slides for Java in summer.

Once again we feel sorry for your nuisance,

Hi Mudassir,


I’m following this up for my colleague James, has there been any progress on it? Is there a way I can see the issue tracking system so I can see when it is likely to be resolved?

Thanks,
Matt

Hi Matt,

Unfortunately, our worthy clients don't have access to our issue tracking system. The forums are the places where our clients can query the status of their issues. You will be pleased to listen that both of issues 16164 and 16690 associated with this thread have been resolved and the fix will be available in the new release of Aspose.Slides for Java 2.3.0, which is due to be launched by next month.

Thanks and Regards,

Hi Mudassir,

Any news on when the new slides version is going to be available? We are really looking forward that this problem is solved.
Thanks,

Tani

Dear Tani,

You will be pleased to know that the specified issued have been resolved and we are planing to release Aspose.Slides for Java 2.3.0 by this weekend. You will also be notified automatically, once the issue is resolved.

Thanks and Regards,

The issues you have found earlier (filed as 16690;16164) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.