lib: Fix PDF rendering when using a custom set view script

This commit is contained in:
Eric Lippmann 2015-02-11 15:14:40 +01:00
parent 03100b8c59
commit ded045e32c
1 changed files with 7 additions and 4 deletions

View File

@ -37,19 +37,22 @@ class Pdf extends DOMPDF
public function renderControllerAction($controller)
{
$this->assertNoHeadersSent();
ini_set('memory_limit', '384M');
ini_set('max_execution_time', 300);
$request = $controller->getRequest();
$viewRenderer = $controller->getHelper('viewRenderer');
$controller->render(
$viewRenderer->getScriptAction(),
$viewRenderer->getResponseSegment(),
$viewRenderer->getNoController()
);
$layout = $controller->getHelper('layout')->setLayout('pdf');
$controller->render();
$layout->content = $controller->getResponse();
$html = $layout->render();
$imgDir = Url::fromPath('img');
$html = preg_replace('~src="' . $imgDir . '/~', 'src="' . Icinga::app()->getBootstrapDirectory() . '/img/', $html);
$this->load_html($html);
$this->render();
$request = $controller->getRequest();
$this->stream(
sprintf(
'%s-%s-%d.pdf',