static public function mpdf( $html_path, $pdf_path, $css_rel_path, $format = 'A4', $download = false) { // reporting komplett abschalten $error_reporting = error_reporting(); error_reporting(0); ProjectConfiguration::registerMPDF(); $mpdf=new mPDF('ch-DE',$format,'8','DejaVuSansCondensed',15,15,30,15,10,10); $mpdf->packTableData = true; //$mpdf->debug = true; $mpdf->SetDisplayMode('fullpage'); $mpdf->defaultfooterfontstyle=''; $mpdf->defaultfooterfontsize='8'; $mpdf->SetFooter(basename($pdf_path).'|Stand: {DATE j.m.Y H:i}|Seite {PAGENO}/{nbpg}'); $mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list $mpdf->shrink_tables_to_fit=1; // LOAD a stylesheet #$stylesheet = file_get_contents(sfConfig::get('sf_web_dir').'/css/backend/pdf/class_etat.css'); $stylesheet = file_get_contents(sfConfig::get('sf_web_dir').'/css/'.$css_rel_path); $mpdf->WriteHTML($stylesheet,1); // parameter 1 indicates this is css $html = file_get_contents($html_path); $mpdf->WriteHTML($html,2); //$mpdf->SetTitle(); $mpdf->SetAuthor(''); $mpdf->SetCreator('rockstep'); if ($download) { $mpdf->Output( $pdf_path, 'I'); } else { $mpdf->Output( $pdf_path, 'F'); } error_reporting($error_reporting); }
public function executeNamebadge(sfWebRequest $request) { ProjectConfiguration::registerMPDF(); // Error temporär reporting komplett abschalten $error_reporting = error_reporting(); error_reporting(0); $mpdf=new mPDF('ch-DE','A4','16','DejaVuSansCondensed',15,15,10,15,10,10); $mpdf->img_dpi = 300; $mpdf->dpi = 300; $mpdf->SetDisplayMode('fullpage'); $mpdf->defaultfooterfontstyle=''; $mpdf->defaultfooterfontsize='8'; $mpdf->SetFooter('Namensschilder '.$this->class.'|Stand: {DATE j.m.Y H:i}|Seite {PAGENO}/{nbpg}'); $mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list // LOAD a stylesheet // $stylesheet = file_get_contents(sfConfig::get('sf_web_dir').'/css/kursliste_pdf.css'); // $mpdf->WriteHTML($stylesheet,1); // The parameter 1 tells that this is css/style // CAN NOT BE DONE FROM TASK ...... !!!! //$this->students = $this->class->getEnrolments( true ); $html = sfContext::getInstance()->getController()->getPresentationFor("dsClassStudent", "namebadgeHtml"); $mpdf->WriteHTML($html); // $mpdf->WriteHTML($html, 2); $mpdf->SetTitle('Name Badges'); $mpdf->SetAuthor('Kursbox 1.0'); //$mpdf->setFilename('foobar.pdf'); $mpdf->Output($this->class->getSlug().'_namebadges.pdf', 'I'); return sfView::NONE; }