Greetings,
I’m successfully creating thumbnails from PPT files using Aspose and PHP, but I can’t seem to be able to get the same process going with PPTX files. The file seems to open correctly (or at least no errors are thrown) using the following command:
$pres =
new Java(“com.aspose.slides.pptx.PresentationEx”, $file);
However, any attempt to use that object results in errors:
$lastSlidePosition = $pres->getSlides()->size();
$lastSlidePosition =
$pres->getSlides()->getLastSlidePosition();
$slide = $pres->getSlides()->get($i);
Note that all of these calls work fine when using a PPT file, although I instantiate it with a call like this:
$pres=new Java(“com.aspose.slides.Presentation”,“$file”);
I’ve scoured the aspose site and google in general for a working example of PHP opening an PPTX file, but have not found anything. Is such an example available, or can such an example be provided here?
In case it’s pertinent, the error I’m receiving seems a bit indeterminate to me, but I’m not a Java expert. Here’s the top of the error output by the exception object captured by my try-catch block:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: java.lang.RuntimeException: PHP Warning: Unchecked exception detected: [[o:Response$UndeclaredThrowableErrorMarker]:“FATAL: Undeclared java.lang.RuntimeException detected. java.lang.Exception: CreateInstance failed: new com.aspose.slides.pptx.PresentationEx((o:String)[o:String]). Cause: com.aspose.slides.pptx.PptxException: Unknown file format. VM: 1.6.0_22@http://java.sun.com/” at:
#-12 com.aspose.slides.obfuscated.azo.(SourceFile:182)
#-11 com.aspose.slides.pptx.PresentationEx.(SourceFile:1156)
#-10 com.aspose.slides.pptx.Pres[…]Java.inc(535): java_Client->getInternalResult()
#4 /var/lib/tomcat6/webapps/drupal/java/Java.inc(1929): java_Client->createObject(‘com.aspose.slid…’, Array)
#5 /mnt/storage/code/teamspace/winstorm/colgate.eGuidebook/sites/all/modules/custom/pp_aspose/tomcat/aspose.php(170): Java->Java(‘com.aspose.slid…’, ‘/mnt/storage/co…’)
#6 /mnt/storage/code/teamspace/winstorm/colgate.eGuidebook/sites/all/modules/custom/pp_aspose/tomcat/aspose.php(45): create_slides()
#7 {main}] in /var/lib/tomcat6/webapps/drupal/java/Java.inc on line 202
PHP Fatal error: An unchecked exception occured during script execution. Please check the server log files for details. in /var/lib/tomcat6/webapps/drupal/java/Java.inc on line 776php.java.servlet.fastcgi.FastCGIServlet.handle(FastCGIServlet.java:499) php.java.servlet.fastcgi.FastCGIServlet.doGet(FastCGIServlet.java:521) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) php.java.servlet.PhpCGIFilter.doFilter(PhpCGIFilter.java:126)
root cause
java.lang.RuntimeException: PHP Warning: Unchecked exception detected: [[o:Response$UndeclaredThrowableErrorMarker]:“FATAL: Undeclared java.lang.RuntimeException detected. java.lang.Exception: CreateInstance failed: new com.aspose.slides.pptx.PresentationEx((o:String)[o:String]). Cause: com.aspose.slides.pptx.PptxException: Unknown file format. VM: 1.6.0_22@http://java.sun.com/” at:
#-12 com.aspose.slides.obfuscated.azo.(SourceFile:182)
#-11 com.aspose.slides.pptx.PresentationEx.(SourceFile:1156)
#-10 com.aspose.slides.pptx.Pres[…]Java.inc(535): java_Client->getInternalResult()
#4 /var/lib/tomcat6/webapps/drupal/java/Java.inc(1929): java_Client->createObject(‘com.aspose.slid…’, Array)
#5 /mnt/storage/code/teamspace/winstorm/colgate.eGuidebook/sites/all/modules/custom/pp_aspose/tomcat/aspose.php(170): Java->Java(‘com.aspose.slid…’, ‘/mnt/storage/co…’)
#6 /mnt/storage/code/teamspace/winstorm/colgate.eGuidebook/sites/all/modules/custom/pp_aspose/tomcat/aspose.php(45): create_slides()
#7 {main}] in /var/lib/tomcat6/webapps/drupal/java/Java.inc on line 202
PHP Fatal error: An unchecked exception occured during script execution. Please check the server log files for details. in /var/lib/tomcat6/webapps/drupal/java/Java.inc on line 776php.java.servlet.fastcgi.FastCGIServlet.parseBody(FastCGIServlet.java:409) php.java.servlet.fastcgi.FastCGIServlet.execute(FastCGIServlet.java:433) php.java.servlet.fastcgi.FastCGIServlet.handle(FastCGIServlet.java:481) php.java.servlet.fastcgi.FastCGIServlet.doGet(FastCGIServlet.java:521) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) php.java.servlet.PhpCGIFilter.doFilter(PhpCGIFilter.java:126)</pre></font></span><span class="Apple-style-span" style="background-color: rgb(255, 255, 255); "><pre><br></pre><pre style="font-family: Tahoma, Arial, sans-serif; "><br></pre><pre style="font-family: Tahoma, Arial, sans-serif; ">Thanks in advance!</pre><pre style="font-family: Tahoma, Arial, sans-serif; ">Sean ~ Teamspace</pre></span></div><div><br></div>