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

Free Support Forum - aspose.com

PHP Fatal Error

I’ve been struggling with setting up Aspose.Slides for Java on a Zend Server in Windows 7 to do some proof-of-concept which will dictate what third-party products we’ll be buying for all our websites. I set up the following php page and demo.ppt file to test:

<?php
require_once("AsposeSlides.php");

//Instantiate a Presentation object that represents a PPT file
$pres = Classfactory::NewPresentation("C:\\demo.ppt");

//Accessing a slide using its slide position
$slide = $pres->getSlideByPosition(1);

//Adding a rectangle shape into the slide by defining its X,Y postion,
//width and height
$slide->getShapes()->addRectangle(1400,1100,3000,2000);

//Creating a file output stream to write the output file
$pres->write("C:\\modified.ppt");
?>

I was under the impression that in my index.php page, requiring the AsposeSlides.php file was sufficient. However, when I run my test page, I get the following error:

Call to a member function getSlideByPosition() on a non-object in C:\Test\AsposeSlides.php
on line 3715

I followed whatever instructions I could find (documentation seems to be lacking for my setup),
but I can not find where I’m going wrong.

Hi Angelo,

Thanks for your interest in Aspose.Slides.

I have observed the code snippet shared by you and have observed inconsistency in the code following code line. You may need to correct the reference to Aspose.Slides.php wrapper class. If you are using PHP 5 then you can use the code shared by you. Otherwise for PHP 4, you need to devise your own wrapper classes. Please visit this article for your kind reference.

//Wrong
require_once("AsposeSlides.php");


//Correct
require_once(
"aspose.slides.php");

Thanks and Regards,

OS: Windows 7 64-bit
Zend Server Community 5.1.0
PHP 5.3.5
Zend Java Bridge 3.1.21

This is extremely frustrating. I know
the JavaBridge is working (did the timestamp test). I’ve tried with and
without wrapper classes to no avail (as per previous comment). The examples I’ve tried are all
from Aspose.com’s documentations, and I’ve followed and re-followed
those instructions to a T.

The error with wrapper class:
PHP Fatal error: Call to a member function getSlideByPosition() on a non-object in C:\Program Files (x86)\Zend\Apache2\htdocs\poc\aspose\aspose.slides.php on line 3714
The error without wrapper class:
PHP Fatal error: Call to undefined method JavaException::toString() in C:\Program Files (x86)\Zend\Apache2\htdocs\poc\aspose\index.php

Hi Angelo,

Please accept my apologies for the delayed response.

We are working on your issue by creating similar environment as you have. Actually, we have not tested our product with Zend Server before and we may need to setup the environment to help you out further. We will share the response with you ASAP. Meanwhile, if you have also been able to execute the code snippet then please share the knowledge with us as well so that we may use it for future reference.

Thanks and Regards,

Hi Angelo,

As we shared with you earlier that we have not tested our product with Zend Server before so we have logged this issue in our issue tracking system as SLIDESJAVA-28223. You will be updated via this forum thread once this issue is resolved.

We are sorry for your inconvenience.

Mudassir:

//Wrong
require_once("AsposeSlides.php");


//Correct
require_once(
"aspose.slides.php");



I can understand why Angelo used "AsposeSlides.php" instead of "aspose.slides.php." The first exists. I can't find the second one at all. It's not in the aspose-slides-2.5.0-java.zip file I downloaded. Where can I get a copy?

Hi Angelo,

I am able to reproduce the same problem.
For the sake of correction, I have logged it in our issue tracking
system as SLIDESJAVA-28325. Our team will look into this issue and you
will be updated via this forum thread once it is resolved.

We apologize for your inconvenience.