My company is looking for a library to handle PowerPoint slides and I am evaluating Aspose.Slides for Java.
One of our criteria is the ability to work with .pptx files, however I have not been able to get Aspose.Slides for Java 1.9.0 to work with them. The following code, which just tries to open a .pptx file, fails with the attached presentation:
import java.io.File;
import java.io.FileInputStream;
import com.aspose.slides.Presentation;
/**
* Test Aspose.Slides PPTX loading functionality.
*
* @author Bright Interactive
*/
public class OpenPPTX
{
public static final String PRESENTATION_FILE_NAME = “testdata/simple.pptx”;
public static void main(String[] args) throws Exception
{
//
// Open and set license
//
// License lic = new License();
// try {
// lic.setLicense(new FileInputStream(new File(“Aspose.Slides.lic”)));
// } catch (Exception e) {
// }
System.out.println("Opening " + PRESENTATION_FILE_NAME + “…”);
FileInputStream is1 = new FileInputStream(new File(PRESENTATION_FILE_NAME));
try
{
Presentation part1 = new Presentation(is1);
}
finally
{
is1.close();
}
}
}
Here is the stack trace:
Opening testdata/simple.pptx…
Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: 109
at com.aspose.slides.obfuscated.jd.try(SourceFile:91)
at com.aspose.slides.obfuscated.jd.do(SourceFile:60)
at com.aspose.slides.obfuscated.V.case(SourceFile:79)
at com.aspose.slides.obfuscated.V.new(SourceFile:58)
at com.aspose.slides.obfuscated.V.(SourceFile:50)
at com.aspose.slides.obfuscated.C.do(SourceFile:35)
at com.aspose.slides.obfuscated.C.(SourceFile:31)
at com.aspose.slides.Presentation.(SourceFile:475)
at org.devrx.aspose.slides.examples.OpenPPTX.main(OpenPPTX.java:48)
Are there any plans to improve support for .pptx files in a future release of Aspose.Slides?
Thanks,
Francis
Dear Francis,
Yes, we have plans to improve PPTX support further. Instead, we have made a good enough progress toward it in .NET version and will soon move all these improvements to JAVA version as well.
We have encountered this exact same problem with code deployed at our customer’s site. We currently have the 1.9.3.2 version for Java, so apparently it has not been fixed as yet. This presents a serious problem. When will functioning pptx version be available?
Thanks,
Kent
Hi Kent,
A new release is expected in a few weeks to fix such issues.
The issues you have found earlier (filed as 10444) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
Unfortunately, this problem (issue 10444) does not appear to be fixed. The same exception (Error 109) is still thrown when using the new version of slides (2.0.0.6). Here is the exception:
java.lang.ArrayIndexOutOfBoundsException: 109
at com.aspose.slides.obfuscated.vw.try(SourceFile:111)
at com.aspose.slides.obfuscated.vw.do(SourceFile:134)
at com.aspose.slides.obfuscated.br.new(SourceFile:58)
at com.aspose.slides.obfuscated.br.(SourceFile:47)
at com.aspose.slides.obfuscated.au.do(SourceFile:34)
at com.aspose.slides.obfuscated.au.(SourceFile:30)
at com.aspose.slides.Presentation.(SourceFile:513)
Kent
Hi Kent,
Its working fine on my end. It requires Aspose.Metafiles for Java too in the build path.
Muhammad,
I added the Aspose Metafiles jar to the project, but the error still occurs. If the lack of that jar was the problem, I would think that it would be throwing a ClassNotFoundException, not an ArrayIndexOutOfBoundsException.
Kent
Hi Kent,
Try the following code:
import com.aspose.slides.pptx.*;
import java.io.*;
public class TestPPTX {
public static void main(String[] args){
getPPTX();
}
public static void getPPTX()
{
try {
FileInputStream is=new FileInputStream("d:\\ppt\\frank\\simple.pptx");
PresentationEx pres = new PresentationEx(is);
} catch (IOException e) {
e.printStackTrace();
}
}
}
Hi,
Using Presentation object when we open the PPT file, I was able to create a thumbnail image of the slide. Below is the code.
public class AsposeThumbnail {
public static void main(String[] args) {
try {
String inFileName = "Slides01.ppt";
Presentation pres = new Presentation(new FileInputStream(new File(inFileName)));
System.out.println("Total Slides: " + pres.getSlides().size());
Slide slide = pres.getSlideByPosition(2);
BufferedImage image=slide.getThumbnail(new Dimension(1280, 1024));
ImageIO.write(image,"jpeg", new File("Slide2.jpg"));
}
catch(Exception ex) {
ex.printStackTrace();
}
}
}
But same functionality am not able to achieve using PresentationEx class. Can someone suggest any alternative for this?
Hi,
1) You should use PresentationEx, SlideEx class instances packaged in com.apose.slides.pptx instead of Presentation and Slide respectively for PPTX.
2) Image rendering is not supported for pptx. It is supported in Aspose.Slides for .NET.
3) An issue with issue id 11378 has been created for provision of image rendering support against pptx slides. Our development team will work it out and a notification will be sent to this post as soon as this feature is supported..
The issues you have found earlier (filed as SLIDESJAVA-11378) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.