Skip to content

Commit dbf00ce

Browse files
committed
Created Test for compiling, processing and listing params
1 parent cca55c1 commit dbf00ce

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

examples/example.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
require __DIR__ . '/../src/JasperPHP/JasperPHP.php';
4+
5+
$outputPdfRtf = __DIR__;
6+
$jasperFile = __DIR__ . '/hello_world.jasper';
7+
$jrxmlFile = __DIR__ . '/hello_world.jrxml';
8+
$jrxmlParamsFile = __DIR__ . '/hello_world_params.jrxml';
9+
10+
$jasper = new JasperPHP\JasperPHP;
11+
12+
// compiling jrxml file into jasper file
13+
$jasper->compile($jrxmlFile)->execute();
14+
15+
// processing jasper file into pdf and rtf
16+
$jasper->process(
17+
$jasperFile,
18+
$outputPdfRtf,
19+
array("pdf", "rtf")
20+
)->execute();
21+
22+
// Listing Parameters of jasper file
23+
$jasperParameters = $jasper->list_parameters($jrxmlParamsFile)->execute();
24+
print "<h2>Listing Parameters of jasper file</h2>\n";
25+
foreach($jasperParameters as $parameter_description) {
26+
print "<pre>" . $parameter_description . "</pre>\n";
27+
}

0 commit comments

Comments
 (0)