How to Crystal report use in php?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Noorain
    New Member
    • Mar 2008
    • 57

    How to Crystal report use in php?

    hi

    i use following codes. here crystal report open in pdf format.

    Code:
    <?php 
    
    //- Variables - for your RPT and PDF 
    //echo "Print Report Test"; 
    $my_report = "D:\\Program Fiels\\xampp\\htdocs\\RPT\\RPT-list.rpt"; // 
    //rpt source file 
    $my_pdf = "D:\\Program Fiels\\xampp\\htdocs\\RPT\\RPT-list.pdf"; // RPT export to pdf file 
    //-Create new COM object-depends on your Crystal Report version 
    $ObjectFactory= new COM("CrystalReports10.ObjectFactory.1") or die ("Error on load"); // call COM port 
    $crapp = $ObjectFactory-> CreateObject("CrystalRuntime.Application.10"); // create an instance for Crystal 
    $creport = $crapp->OpenReport($my_report, 1); // call rpt report 
    
    // to refresh data before 
    
    //- Set database logon info - must have 
    $creport->Database->Tables(1)->SetLogOnInfo("servername", "username", "password", "databasename"); 
    //- field prompt or else report will hang - to get through 
    $creport->EnableParameterPrompting = 0; 
    
    //- DiscardSavedData - to refresh then read records 
    $creport->DiscardSavedData; 
    $creport->ReadRecords(); 
    
        
    //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; 
    
        
        
    ?>
    But i want to crystal report data open in web browser(ie). Crystal report parameter passing through php script. Is it Possible. Please help me.
  • miltonlp
    New Member
    • Sep 2010
    • 1

    #2
    Hi,

    I have the same problem, you got any solution?

    Comment

    • naeemulhaq07
      New Member
      • Nov 2022
      • 1

      #3
      just add these line at the end

      print "<embed src=\"C:\\xampp \\htdocs\\test. pdf\" width=\"100%\" height=\"100%\" >"

      Comment

      • Vanisha
        New Member
        • Jan 2023
        • 26

        #4
        Crystal Reports is a popular reporting tool that allows users to create and design reports using various data sources. While it is primarily designed for use with Microsoft technologies, it is also possible to use Crystal Reports with PHP. Here's a high-level overview of how to use Crystal Reports in PHP:
        Install Crystal Reports
        Connect to a Data Source
        Create a Report
        Export the Report
        Use the Report in PHP
        Join PHP Online Course
        Here are some additional resources to help you get started with using Crystal Reports in PHP:
        Crystal Reports PHP Integration Guide
        PHP Crystal Reports
        Using Crystal Reports in PHP

        Comment

        Working...