dev-master
9999999-devLaravel package to render JasperReports
Wallogit.com
2017 © Pedro Peláez
Laravel package to render JasperReports
A Laravel package to render jasperReports. This extension was based on PHPJasperXML, (*1)
Add the following lines to your composer.json file, (*2)
... andjelko/laravel-phpjasperxml": "^1.0" }
Then update your packages with:, (*3)
composer update
Add the Service Provider to you config/app.php file, (*4)
'providers' => [ ... Andjelko\PhpJasperXML\JasperReportsServiceProvider::class, ]
And add an alias to the PHPJasperXML class, (*5)
'aliases' => [ ... 'PHPJasperXML' => Andjelko\PhpJasperXML\PHPJasperXML::class, ]
Create an includes folder on your app and save there your jrxml files., (*6)
Create a ReportController with the following code, (*7)
<?php
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"));
}
}
Then modify your app/routes/web.php file to add a route to access any report., (*8)
Route::get('report/{report}', 'ReportController@viewreport')->name('report.show');
Laravel package to render JasperReports