1. Go to this page and download the library: Download lopezsoft/jasperphp 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/ */
public function generateReceipt($id) {
$datafile = base_path('/storage/jasper/data.json');
$output = base_path('/storage/jasper/data'); //indicate the name of the output PDF
JasperStartet::process(
base_path('/resources/reports/taxinvoice80.jrxml'),
$output,
array("pdf"),
array("msg"=>"Tax Invoice"),
array("driver"=>"json", "json_query" => "data", "data_file" => $datafile)
)->execute();
}