Skip to Content
0
Former Member
Mar 10, 2009 at 08:48 PM

Crystal Reports from PHP using COM

444 Views

I have tried copying various snippets of PHP code to render a Crystal Report in PDF which I can then stream to the browser, but I never get past the creation of the CrystalRunTime.Application. (Earlier examples had CrystalDesignRunTime.Application instead; they did not work either). Any suggestions what is wrong here?

$ObjectFactory= new COM("CrystalReports12.ObjectFactory.1") or die ("Error on load");
 
echo "<p>ObjectFactory created.<p>About to create CrystalRunTime.Application...";

try {
	$crapp = $ObjectFactory-> CreateObject("CrystalRunTime.Application");
} catch (com_exception $e) {
	echo("Error on instance creation:<br>".$e->getMessage().'<p>'.$e->getTraceAsString());
	echo "<p>".$e;
	exit;
}

Here is the output:

ObjectFactory created.

About to create CrystalRunTime.Application...Error on instance creation:

Source: Unknown

Description: Unknown

#0 C:\xampp\htdocs\tempo\comtest.php(11): com->CreateObject('CrystalRunTime....') #1 exception 'com_exception' with message 'Source: Unknown Description: Unknown' in C:\xampp\htdocs\tempo\comtest.php:11 Stack trace: #0 C:\xampp\htdocs\tempo\comtest.php(11): com->CreateObject('CrystalRunTime....') #1