How to using it in PHP?

Hello to you

I'm using VB6 with FastReport for COM/ActiveX

In VB6, I Write simple code as shown below :
Dim report As TfrxReport
Dim export As IfrxBuiltinExports

Private Sub Form_Load()
Set report = CreateObject("FastReport.TfrxReport")
End Sub

Private Sub Command1_Click()
report.LoadReportFromFile ("d:/rptmember.fr3")
report.PrepareReport (True)
Set export = report
export.ExportToPDF "d:/demo.pdf", False, False, False, False, "", ""

End Sub

The above code is work well in VB6

My questions is How to translate it into PHP?

I tried but still not works, as shown
<?php
$report= New COM("FastReport.TfrxReport");
$export= New COM("FastReport.TfrxDispatchableExports");

$report->LoadReportFromFile("d:/rptmember.fr3");
$report->PrepareReport(True);
Set export = report
$export->ExportToPDF("d:/demo.pdf", False, False, False, False, "", "");


$len = filesize("d:/demo.pdf");
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=d:/demo.pdf");
readfile("d:/demo.pdf");
?>

Please advice and correct my code

Thanks & Regards,
Steven

Comments

  • edited 7:44AM
    Is it possible to build the page tables are fixed, and the table reports the number of fields is not? >
  • Hi Steven,

    You’re definitely on the right track with your approach. The main issue here is that PHP COM works differently compared to VB6, so a direct translation won’t run smoothly. The Set keyword, for example, isn’t supported in PHP, and you’ll also need to ensure that the FastReport COM components are properly registered on your server. It’s often about mapping the right COM objects and making sure the export function is called correctly.

    If you’re still running into trouble, I’d recommend double-checking that the FastReport ActiveX/COM libraries are installed and accessible, and that COM is enabled in your PHP setup. Many developers face similar hurdles when shifting from VB6 to PHP, and getting the environment right is usually the key step.

    As someone working with a Mobile App Development Company in USA, I’ve seen how even small mismatches in setup can lead to frustrating errors. Once you align the COM objects and confirm the server configuration, your report export should work as expected.

    Hope this gives you some direction!

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.