@@ -272,17 +272,16 @@ public function xmlToPdf()
272272 $data_file = public_path() . '/report/CancelAck.xml';
273273 $driver = 'xml';
274274 $xml_xpath = '/CancelResponse/CancelResult/ID';
275-
276- \JasperPHP::process(
277- public_path() . '/report/CancelAck.jrxml',
278- $output,
275+
276+ $php_jasper = new JasperPHP;
277+
278+ $php_jasper->process(
279+ public_path() . '/report/CancelAck.jrxml',
280+ $output,
279281 array($ext),
280282 array(),
281- array('data_file' => $data_file, 'driver' => $driver, 'xml_xpath' => $xml_xpath),
282- false,
283- false
284- )->execute();
285-
283+ array('data_file' => $data_file, 'driver' => $driver, 'xml_xpath' => $xml_xpath))->execute();
284+
286285 header('Content-Description: File Transfer');
287286 header('Content-Type: application/octet-stream');
288287 header('Content-Disposition: attachment; filename='.time().'_CancelAck.'.$ext);
@@ -293,16 +292,15 @@ public function xmlToPdf()
293292 flush();
294293 readfile($output.'.'.$ext);
295294 unlink($output.'.'.$ext);
296-
297295 }
298296```
299297** Note:**
300298
301299To use the example above you must copy the sample files located at:
302300
303- ** \vendor\lavela\phpjasper\src\JasperStarter\ examples\CancelAck.jrxml**
301+ ** \vendor\lavela\phpjasper\examples\CancelAck.jrxml**
304302and
305- ** \vendor\lavela\phpjasper\src\JasperStarter\ examples\CancelAck.xml**
303+ ** \vendor\lavela\phpjasper\examples\CancelAck.xml**
306304to folder:
307305** \public\report**
308306
@@ -322,15 +320,16 @@ public function jsonToPdf()
322320 $driver = 'json';
323321 $json_query= "contacts.person";
324322 $data_file = public_path() . '/report/contacts.json';
325-
326- \JasperPHP::process(
323+
324+ $php_jasper = new JasperPHP;
325+
326+ $php_jasper->process(
327327 public_path() . '/report/json.jrxml',
328328 $output,
329329 array($ext),
330330 array(),
331- array('data_file' => $data_file, 'driver' => $driver, 'json_query' => $json_query
332- )->execute();
333-
331+ array('data_file' => $data_file, 'driver' => $driver, 'json_query' => $json_query))->execute();
332+
334333 header('Content-Description: File Transfer');
335334 header('Content-Type: application/octet-stream');
336335 header('Content-Disposition: attachment; filename='.time().'_Contacts.'.$ext);
@@ -341,16 +340,15 @@ public function jsonToPdf()
341340 flush();
342341 readfile($output.'.'.$ext);
343342 unlink($output.'.'.$ext);
344-
345343 }
346344```
347345** Note:**
348346
349347To use the example above you must copy the sample files located at:
350348
351- ** \vendor\lavela\phpjasper\src\JasperStarter\ examples\json.jrxml**
349+ ** \vendor\lavela\phpjasper\examples\json.jrxml**
352350and
353- ** \vendor\lavela\phpjasper\src\JasperStarter\ examples\contacts.json**
351+ ** \vendor\lavela\phpjasper\examples\contacts.json**
354352to folder:
355353** \public\report**
356354
0 commit comments