I want to print a report from the Jasper Report Server in Drupal.
I use their PHP Client in my own controller.
$report = $jasperClient->reportService()->runReport($pathJS, $format, null, null, $controls);
I have an answer from the server and the images are displayed for a simple report, but when the report contains JavaScript code, the page remains white.
I tried using the following code.
$response = New Response();
$response->setContent($report);
return $response;
The report opens in a new page (not themed by Drupal) and all the elements are presents in the page. I want to integrate it into Drupal, so I created my own html.twig file. In my controller I use the following code.
$build = array(
'#type' => 'inline_template',
'#format' => 'full_html',
'#theme' => 'jasperReportTheme',
'#response' => $report
);
return $build;
The HTML markup from Jasper is displayed as text. To test I put this text into a test.html file and opened with a browser. Everything looks ok just in Drupal the HTML code is displayed as text.
In my html.twig template I tried several possibilities such as {{Response}}
or {{Response | RAW}}
without success.