$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content

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

Mar 10, 2017 at 11:19 PM


avatar image


I need to print the .rpt file in the browser using PHP.

The code that I use is:


//- 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 "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?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Don Williams
Mar 10, 2017 at 11:20 PM

You are using the 11.5 RDC, no longer supported.

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


10 |10000 characters needed characters left characters exceeded