Free Support Forum -

Please help me get Aspose working with PHP!

I really need to get Aspose.Powerpoint to work with PHP. I’ve been able to perform much functionality just using the COM Powerpoint.Application object, but we all know that is not the right way to handle server-based PPT functionality.

It seems to me that the .NET version will be very easy to work with… once I can get the initial object instantiated!

Just FYI, here is a brief overview of PHP’s .NET capability:

$obj = new DOTNET(“assembly”, “classname”)

The DOTNET class allows you to instantiate a class from a .Net assembly and call its methods and access its properties.

string DOTNET:Big SmileOTNET ( string assembly_name, string class_name [, int codepage] )

DOTNET class constructor. assembly_name specifies which assembly should be loaded, and class_name specifies which class in that assembly to instantiate. You may optionally specify a codepage to use for unicode string transformations; see the COM class for more details on code pages.

The returned object is an overloaded object, which means that PHP does not see any fixed methods as it does with regular classes; instead, any property or method accesses are passed through to COM and from there to DOTNET. In other words, the .Net object is mapped through the COM interoperability layer provided by the .Net runtime.

Once you have created a DOTNET object, PHP treats it identically to any other COM object; all the same rules apply.

So if I wanted to instantiate an Aspose.Powerpoint Presentation object, what would you suggest that I use for assembly name and class name?

If I can get this to work, I would be happy to provide detailed (and documented) sample PHP code to post on the forums in case there are other PHP developers interested in the Aspose product(s).

Thank you for any help ya’ll can provide!


Dear Matthew,

To create Presentation object in C# you should use constructor with parameters:

Presentation pres = new Presentation(“file.ppt”);

But PHP’s DOTNET object can be created with default constructor only.
Now I see only one solution. You can use Java version (if you don’t need to render slides):

$pres = new Java(‘com.aspose.powerpoint.Presentation’, ‘file.ppt’);

Thanks Alexey, for the clarification.

I will look further into the capabilities of PHP and when I find a solution on getting PHP and Aspose communicating, I will post my findings here.


A post of mine on usenet was responded to with the following sample code... which should do the trick quite nicely Smile

Imports Aspose.PowerPoint

Public Class PresentationContainer

Public ContainedPresentation As Presentation

Public Sub New()
ContainedPresentation = Nothing
End Sub

Public Sub InitPresentation(sFile As String)
Me.ContainedPresentation = New Presentation(sFile)
End Sub

End Class

Sweeeeeet, eh? So I pasted this code into a file named aspose.vb and attempted to compile it using vbc.

Here is the output from the compiler:

vbc : error BC30420: 'Sub Main' was not found in 'aspose'.
C:\WINNT\Microsoft.NET\Framework\v1.1.4322\aspose.vb(3) : error BC30466: Namespa
ce or type 'PowerPoint' for the Imports 'Aspose.PowerPoint' cannot be found.

Imports Aspose.PowerPoint
C:\WINNT\Microsoft.NET\Framework\v1.1.4322\aspose.vb(7) : error BC30002: Type 'P
resentation' is not defined.

Public ContainedPresentation As Presentation
C:\WINNT\Microsoft.NET\Framework\v1.1.4322\aspose.vb(14) : error BC30002: Type '
Presentation' is not defined.

Me.ContainedPresentation = New Presentation(sFile)

So, I uninstalled aspose.powerpoint and re-downloaded it and reinstalled it. I get the exact same messages when compiling.

Is there a step I am missing when it comes to installing aspose.powerpoint?

Dear Matthew,

vbc.exe /target:library /reference:“C:\Program Files\Aspose\Aspose.PowerPoint\Bin\Aspose.PowerPoint.dll” aspose.vb

Thanks for that help. Major progress is being made! I will post a more formal document when I get some other details ironed out (e.g. trying to save a thumbnail and attempting to use an un-creatable .net class in PHP(System.Drawing.Imaging.ImageFormat) to specify the output format).


An Aspose.Powerpoint Presentation object has been instantiated and is begin used. Whew!