среда, 6 апреля 2011 г.

symfony render PDF 2

require_once("dompdf_config.inc.php");
$html =
    '<html><body>'.
    '<p>Some text</p>'.
    '</body></html>';

$this->$dompdf = new DOMPDF();
$this->$dompdf->load_html($html);
$this->dompdf->set_paper('a4', 'portrait');
$this->dompdf->render();
$pdf = $this->dompdf->output()

$response = $this->getContext()->getResponse();
$response->clearHttpHeaders();
$response->setHttpHeader('Pragma', 'public');
$response->setHttpHeader('Cache-Control', '');
$response->setHttpHeader('Content-Type', 'application/pdf');
// line deleted
$response->setContent($pdf);

return sfView::NONE;

Комментариев нет:

Отправить комментарий