Hi, I am new to crystal report. I want to use CR 11 integrated with my web based application. Now as entire application is designed in PHP, I need to use PHP, use COM, to pass parameters and generate PDF report.
I have following question.
Will I need CR server ?
How do i actually invoke CR from PHP ?
Right now I am doing following
$my_report = "C:
Inetpub
wwwroot
test
test.rpt";
$my_pdf = "C:\Inetpub\wwwroot\test
MyReport.pdf";
try
{
$ObjectFactory = new COM ( 'CrystalRuntime.Application' );
}
catch ( exception $e )
{
echo 'caught exception: ' . $e->getMessage () . ', error trace: ' . $e->getTraceAsString ();
}
$crapp = $ObjectFactory->CreateObject("CrystalDesignRunTime.Application");
$creport = $crapp->OpenReport($my_report, 1);
$creport->Database->Tables(1)->SetLogOnInfo("server IP address", "db_name", "username", "password");
$creport->EnableParameterPrompting = 0;
$creport->DiscardSavedData;
$creport->ReadRecords();
$creport->FormulaFields->Item(1)->Text = ("'My Report Title'");
$creport->ParameterFields(1)->AddCurrentValue ("FirstParameter");
$creport->ParameterFields(2)->AddCurrentValue (2000);
$creport->ExportOptions->DiskFileName=$my_pdf;
$creport->ExportOptions->PDFExportAllPages=true;
$creport->ExportOptions->DestinationType=1;
$creport->ExportOptions->FormatType=31;
$creport->Export(false);
$creport = null;
$crapp = null;
$ObjectFactory = null;
but i am getting following error
caught exception: Failed to create COM object `CrystalRuntime.Application': Invalid syntax , error trace: #0 C:\Inetpub\wwwroot\cr_test.php(69): com->com('CrystalRuntime....') #1 Notice: Undefined variable: ObjectFactory in C:\Inetpub\wwwroot\cr_test.php on line 78 Fatal error: Call to a member function CreateObject() on a non-object in C:\Inetpub\wwwroot\cr_test.php on line 78
I will appreciate any help provided in this matter