cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports from PHP using COM

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I am having this problem as well.

Former Member
0 Kudos

$ObjectFactory= New COM("CrystalReports11.ObjectFactory.1");

			//------ Create a instance of library Application -------
						
			try 
			{
				$CRobj = $ObjectFactory->CreateObject("CrystalRunTime.Application.11");
			} 
			catch (com_exception $e) 
			{
				echo("<br>Error on instance creation:<br>".$e->getMessage().'<p>'.$e->getTraceAsString().'</p>');
				echo "<p><pre><code>".print_r($e, true)."</code></pre></p>";
				exit;
			}


Source: Unknown
Description: Unknown
#0 C:\xampp\htdocs\analytics\generate_cr.php(103): com->CreateObject('CrystalRunTime....') #1 {main}

com_exception Object
(
    [message:protected] => Source: Unknown
Description: Unknown
    [string:Exception:private] => 
    [code:protected] => -2147352567
    [file:protected] => C:\xampp\htdocs\analytics\generate_cr.php
    [line:protected] => 103
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => C:\xampp\htdocs\analytics\generate_cr.php
                    [line] => 103
                    [function] => CreateObject
                    [class] => com
                    [type] => ->
                    [args] => Array
                        (
                            [0] => CrystalRunTime.Application.11
                        )

                )

        )

    [previous:Exception:private] => 
)

Edited by: EddieM on Dec 9, 2009 9:34 PM