PHP code example of andjelko / laravel-phpjasperxml

1. Go to this page and download the library: Download andjelko/laravel-phpjasperxml library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

andjelko / laravel-phpjasperxml example snippets



namespace App\Http\Controllers;

use PHPJasperXML;
use Response;
class ReportController extends Controller {

    public function viewreport($reporte='')
    {
      $PHPJasperXML = new PHPJasperXML();
      //$PHPJasperXML->fontfamily='freeserif';
      $PHPJasperXML->load_xml_file("reports/".$reporte.".jrxml");
      $PHPJasperXML->transferDBtoArray();
      //Clean the end of the buffer before outputting the PDF
      ob_end_clean();
      //page output method I:standard output  D:Download file
      return Response::make($PHPJasperXML->outpage("I"));
    }

}