Ejemplo n.º 1
0
 /**
  * Processes a template file using dompdf (LGPL).
  *
  * @param Zikula_View $view     Reference to view object.
  * @param string      $template Name of template to use.
  *
  * @return mixed Output.
  */
 protected static function processPdf(Zikula_View $view, $template)
 {
     // first the content, to set page vars
     $output = $view->fetch($template);
     // see http://codeigniter.com/forums/viewthread/69388/P15/#561214
     //$output = utf8_decode($output);
     // then the surrounding
     $output = $view->fetch('include_pdfheader.tpl') . $output . '</body></html>';
     // create name of the pdf output file
     $fileTitle = MUBoard_Util_Controller::formatPermalink(System::getVar('sitename')) . '-' . MUBoard_Util_Controller::formatPermalink(PageUtil::getVar('title')) . '-' . date('Ymd') . '.pdf';
     //if ($_GET['dbg'] == 1) die($output);
     // instantiate pdf object
     $pdf = new DOMPDF();
     // define page properties
     $pdf->set_paper('A4');
     // load html input data
     $pdf->load_html($output);
     // create the actual pdf file
     $pdf->render();
     // stream output to browser
     $pdf->stream($fileTitle);
     // prevent additional output by shutting down the system
     System::shutDown();
     return true;
 }