cancel
Showing results for 
Search instead for 
Did you mean: 

How can I print an .rpt file in the Browser using PHP?

Former Member
0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

You are using the 11.5 RDC, no longer supported.

Try searching first, I'm not sure if PHP will work at all.

Don

Answers (0)