lib: Fix PDF rendering when using a custom set view script
This commit is contained in:
parent
03100b8c59
commit
ded045e32c
|
@ -37,19 +37,22 @@ class Pdf extends DOMPDF
|
||||||
public function renderControllerAction($controller)
|
public function renderControllerAction($controller)
|
||||||
{
|
{
|
||||||
$this->assertNoHeadersSent();
|
$this->assertNoHeadersSent();
|
||||||
|
|
||||||
ini_set('memory_limit', '384M');
|
ini_set('memory_limit', '384M');
|
||||||
ini_set('max_execution_time', 300);
|
ini_set('max_execution_time', 300);
|
||||||
|
$viewRenderer = $controller->getHelper('viewRenderer');
|
||||||
$request = $controller->getRequest();
|
$controller->render(
|
||||||
|
$viewRenderer->getScriptAction(),
|
||||||
|
$viewRenderer->getResponseSegment(),
|
||||||
|
$viewRenderer->getNoController()
|
||||||
|
);
|
||||||
$layout = $controller->getHelper('layout')->setLayout('pdf');
|
$layout = $controller->getHelper('layout')->setLayout('pdf');
|
||||||
$controller->render();
|
|
||||||
$layout->content = $controller->getResponse();
|
$layout->content = $controller->getResponse();
|
||||||
$html = $layout->render();
|
$html = $layout->render();
|
||||||
$imgDir = Url::fromPath('img');
|
$imgDir = Url::fromPath('img');
|
||||||
$html = preg_replace('~src="' . $imgDir . '/~', 'src="' . Icinga::app()->getBootstrapDirectory() . '/img/', $html);
|
$html = preg_replace('~src="' . $imgDir . '/~', 'src="' . Icinga::app()->getBootstrapDirectory() . '/img/', $html);
|
||||||
$this->load_html($html);
|
$this->load_html($html);
|
||||||
$this->render();
|
$this->render();
|
||||||
|
$request = $controller->getRequest();
|
||||||
$this->stream(
|
$this->stream(
|
||||||
sprintf(
|
sprintf(
|
||||||
'%s-%s-%d.pdf',
|
'%s-%s-%d.pdf',
|
||||||
|
|
Loading…
Reference in New Issue