cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

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

0 Likes
View Entire Topic
Former Member
0 Likes

Hi,

I have just downloaded Free 30 day Trial version from SAP Crystal Reports Download website, as at my company is planning to purchase and implement it, and made me responsible for this. And this is the version that has been downloaded.

I just gone to Help -> About Crystal Report, and this is the version number shown there.

I dont know any further detail about why I have this version.

Can you please give me list of all fully supported languages ?

I want to switch from PHP to one of the fully supported language.

Thanks and Regards

Former Member
0 Likes

With CR 2011, there is not SDK support of any kind.

With CR XIR2A, see:

http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7081b21c-911e-2b10-678e-fe062159b...

- Ludek