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

Free Support Forum - aspose.com

PHP Slides

Hi,


I’m trying to figure out how to export slides from a PPT presentation to a set of JPG or PNG images.

I have my code working to a point where I am able to grab each slide reference, which is great, but I have no idea if what I am trying to do is even possible.

For the time being I am using the “saveToSVG” function, however, I always get an error “”
[[o:Exception]:“java.lang.Exception: Invoke failed: [[o:Slide]]->saveToSVG((o:OutputStream)[o:String]). Cause: java.lang.IllegalArgumentException: argument type mismatch VM: 1.6.0_25@http://java.sun.com/” at:
"
I cannot seem to find anything online about just how I might be able to do this, so I am writing you in hopes of finding something, anything out…
Thanks,
–d 



This message was posted using Page2Forum from Cloning a Slide - Aspose.Slides for Java

Hi Luke,

Thanks for your interest in Aspose.Slides.

Please visit this documentation link to create slide thumbnail image. Please let me know, If you have any more queries.

Hi Tahir,


I’ve looked at the tutorial, but I am getting the following error…

[[o:Exception]:“java.lang.Exception: Invoke failed: [[o:Slide]]->getThumbnail((o:Dimension)[o:Dimension]). Cause: java.lang.ClassNotFoundException: Unresolved external reference: java.lang.NoClassDefFoundError: com/sun/media/jai/codec/ByteArraySeekableStream. – Unable to call the method, see the README section “Java platform issues” for details and DO NOT REPORT THIS PROBLEM TO THE PHP/Java Bridge MAILING LIST! VM: 1.6.0_25@http://java.sun.com/” at:
Any ideas why this might be happening? I don’t understand why this class isn’t found… seems like it’s part of the normal java package…

–d

EDIT: I just dove into the AsposeSlides.php file and I don’t see “getThumbnail” as a function… how can I tell if I am using the most up to date version of the API?

EDIT 2: I checked the latest available downloads… not seeing getThumbnail in the PHP there either…

Hi Luke,

It would be great, If you can share your presentation file with us for investigation purposes. We really want
to help you out and need your cooperation.

Hi Tahir,


What file are you looking for exactly? The current PPT I am working with is the demo in the download package…

My code is, essentially, the entire demo that you have pointed me to, except the file I am writing to is writing to a different location on my harddrive.

The code fails on “$image = $slide->getThumbnail($dimension);” every time.

I have no problem sending this to you (should I just post it in this thread?), however, I’m currently just trying to set this up with the demo file and the “getThumbnail” function does not exist in the AsposeSlides.php file I have…

Thanks,

–d

Hi Luke,

Please use the following code snippet to generate thumbnail image of slides. Please use the old version of Aspose.Slides for Java 2.4.0. There is an issue related to PHP with latest version of Aspose.Slides and our development team is currently working on it. You will be updated via this forum thread once this issue is resolved. Please let me know, If you still face any problem.

<?php
try
{
//Instantiate a Presentation object that represents a PPT file
$pres= new Java("com.aspose.slides.Presentation", "C:\\demo.ppt");

//get last position of presentation
$lastSlidePosition = $pres->getSlides()->getLastSlidePosition();

//iterate all slides
for ($pos = 1; $pos <= $lastSlidePosition; $pos++)
{
$slide = $pres->getSlideByPosition($pos);
//Creating the Dimension object to specify the width and height of image
$dimension=new Java("java.awt.Dimension",290,230);
//Getting the thumbnail image of the slide of a specified size
$image=$slide->getThumbnail($dimension);

//Creating the ImageIO class object
$ImageIO = new Java("javax.imageio.ImageIO");

//Creating a file output stream to write the slide thumbnail
$fostream=new Java("java.io.FileOutputStream","C:\\thumbnail2.jpg");

//Saving the thumbnail image in jpeg format
$ImageIO->write($image,"jpeg",$fostream);
}
}
catch(JavaException $ex)
{
echo $ex;
}
?>

Excellent news. I will definitely be trying 2.4…


However, it doesn’t appear to be available on the downloads page: http://www.aspose.com/community/files/72/java-components/aspose.slides-for-java/default.aspx

Any chance you can make it available?

–d

Hi Luke,

Please accept my apology for late response. Please download the latest version of Aspose.Slides for Java 2.6.0.2 to generate thumbnail image of slides. Let me know, If you have any more queries.

Hi Tahir,


I appreciate the latest version, however, you only posted the latest .jar files. I still need an updated version of the PHP library so that I can call “getThumbnail” on my slide item.

Thanks,

–d

Hi Luke,

You just need to update your old jar file with latest jar (2.6.0.2) file. There is no update in Aspose PHP library. I have also attached the AsposeSlides.php in this post.

Hi Tahir,


I think this is where our signals are getting crossed. The issue is that I am calling

$image = $slide->getThumbnail($dimension);

As outlined here: http://www.aspose.com/documentation/java-components/aspose.slides-for-java/creating-slide-thumbnail-image.html

But the application is failing with the error:

Invoke failed: [[o:Slide]]->getThumbnail((o:Dimension)[o:Dimension]). 
Cause: java.lang.ClassNotFoundException: Unresolved external reference: java.lang.NoClassDefFoundError: com/sun/media/jai/codec/ByteArraySeekableStream.
I thought the cause of this was because when I look at the PHP file the “getThumbnail” function doesn’t exist for the “Slide” class, but you are saying this shouldn’t matter, so I am wondering how I might be able to fix this “ClassNotFoundException” as it appears “ByteArraySeekableStream” does not exist…

Hi Luke,

Please use the code share by me earlier in this thread and let me know if you still face problem.

This is getting me EXTREMELY close… and I have just 1 final question.


The licence I have appears to be for Aspose 2.5.0, will that work with the 2.6.0.2 version? If it should work, I have the aspose JAR file in my WEB-INF/lib folder in Tomcat with the licence file in the same directory… is this the proper way to do it?

Thanks,

–d

No worries! I got it! Thanks for all your help tahir!!

Hi again Tahir,


Is it possible to see a list of functions that are available in the PHP engine?

I can’t seem to even grab slide names or anything except the slide id with PHP.

Thanks…

–d

Hi Luke,

Aspose.Slides does not support such functionality.

Hi Tahir,


Thanks for the response, is there a list of functions that ARE available for the PHP slides?

Also, can the PHP slides handle PPTX? It seems to throw an error on PPTX, while PPT works fine…

Thanks,

–d

Hi Luke

Please read the list of Aspose.Slides for Java API from this link. You can work with PPTX files by using Aspose.Slides for Java.