Hi guys,
i need help.. i have this code ive found in php...i tried running but it doesnt work... pls help... thanks in advance.
Chad
<?php
//- Variables - for your RPT and PDF
echo "Print Report Test";
$my_report = "D:\\www\\pIP\\src\\www\\users.rpt"; //rpt source file
$my_pdf = "D:\\www\\pIP\\src\\www\\users.pdf";
$ObjectFactory= new COM("CrystalReports10.ObjectFactory.1") or die ("Error on load");
$crapp = $ObjectFactory->CreateObject("CrystalDesignRunTime.Application"); // create an instance for Crystal
$creport = $crapp->OpenReport($my_report, 1); // call rpt report
//- Set database logon info - must have
$creport->Database->Tables(1)->SetLogOnInfo("IT-Server", "DP", "ace", "a");
/* where...
servername = IT-Server
Databasename = DP
username = ace
password = a*/
//- field prompt or else report will hang - to get through
$creport->EnableParameterPrompting = 0;
//- DiscardSavedData - to refresh then read records
$creport->DiscardSavedData;
$creport->ReadRecords();
$zz= $creport->ParameterFields(1)->SetCurrentValue(500);
//export to PDF process
$creport->ExportOptions->DiskFileName=$my_pdf; //export to pdf
$creport->ExportOptions->PDFExportAllPages=true;
$creport->ExportOptions->DestinationType=1; // export to file
$creport->ExportOptions->FormatType=31; // PDF type
$creport->Export(false);
//------ Release the variables ------
$creport = null;
$crapp = null;
$ObjectFactory = null;
//------And Now -> Embed the report in the webpage ------
print "<embed src=\"D:\\www\\pIP\\src\\www\\users.pdf\" width=\"100%\" height=\"100%\">"
?>