on 03-10-2017 11:19 PM
Hi,
I need to print the .rpt file in the browser using PHP.
The code that I use is:
<?php
//- Variables - for your RPT and PDF echo "Print Report Test";
$my_report = "C:\\TestFolder\\SubFolder1\\MyWebReport.rpt"; // rpt source file
$my_pdf = "C:\\TestFolder\\SubFolder1\\MyWebReport.pdf"; // RPT export to pdf file
//-Create new COM object-depends on your Crystal Report version
$ObjectFactory= new COM("CrystalReports115.ObjectFactory.1") or die ("Error on load"); // call COM port
$crapp = $ObjectFactory-> CreateObject("CrystalDesignRunTime.Application");
// create an instance for Crystal
$creport = $crapp->OpenReport($my_report, 1); // call rpt report
//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=\"C:\\TestFolder\\SubFolder1\\MyWebReport.pdf\" width=\"100%\" height=\"100%\">"
?>
The error is:
Print Report TestPrint Report Test
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `CrystalReports115.ObjectFactory.1': Invalid Sintax. ' in C:\inetpub\wwwroot\wms\test_report.php:13 Stack trace: #0 C:\inetpub\wwwroot\wms\test_report.php(13): com->com('CrystalReports1...') #1 {main} thrown in C:\inetpub\wwwroot\wms\test_report.php on line 13
Someone can help me?
You are using the 11.5 RDC, no longer supported.
Try searching first, I'm not sure if PHP will work at all.
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
11 | |
10 | |
8 | |
8 | |
6 | |
6 | |
6 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.