dev-master
9999999-dev https://github.com/simplisti/lib-jasper-starterJasperStarter PHP interface wrapper
MIT
The Requires
- php ^7.1.3
by Alex Barylski
pdf reporting printing
Wallogit.com
2017 © Pedro Peláez
JasperStarter PHP interface wrapper
Easier interfacing with JasperStarter command line tool., (*1)
This JasperStarter library is simple an object-oriented wrapper for the JasperStarter command line tool, therefore installing the JasperStarter binary is required., (*2)
sed -i "s/jessie main/jessie main non-free contrib/g" /etc/apt/sources.list && apt-get update && apt-get -y install msttcorefonts
cd /tmp
wget https://sourceforge.net/projects/jasperstarter/files/JasperStarter-3.0/jasperstarter-3.0.0-bin.zip/download -O jasperstarter-3.0.0.zip
unzip jasperstarter-3.0.0.zip
mv jasperstarter /opt;
cd /opt/jasperstarter/bin
chmod 777 *
apt-get install -y default-jre
apt-get install cabextract
apt-get install -y xfonts-utils
apt-get -f -y install
ln -s /opt/jasperstarter/jdbc/mysql.jar /usr/share/java/mysql.jar
composer require "simplisti/jasper-starter": "dev-master"
<?php
require 'vendor/autoload.php';
use Jasper\Starter;
use Jasper\Report;
try {
$report = new Report('report_csv.jrxml', 'pdf');
$report->setParameter('ID_WORKORDER', 99999);
$jasper = new Starter('en_CA', 'assets', 'compiled');
$jasper->setParameter('ID_ORGANIZATION', 762363);
$jasper->compile($report);
$outputPathPdf = $jasper->process($report1);
//echo $jasper; // useful debugging
file_put_contents('workorder-10128.pdf', file_get_contents($outputPathPdf));
}
catch (Exception $e) {
echo $e->getMessage();
}
# Configure the Jasper starter service
Simplisti\Lib\JasperStarter\Starter:
arguments:
$locale: '%application.locale%'
$sourcePath: '%application.path.jasper.source%'
$compiledPath: 'compiled'
$optionalArguments:
SOME_ID: '%application.id%'
calls:
- method: setDatasource
arguments:
- 'mysql'
- method: setDatabaseUrl
arguments:
$url: '%env(DATABASE_URL)%'
JasperStarter PHP interface wrapper
MIT
pdf reporting printing