Example #1
0
 public static function new_pdf($orientation = 'P', $unit = 'mm', $format = null)
 {
     ini_set('memory_limit', '512M');
     require_once TCPDF_DIR . 'tcpdf.php';
     self::$default_font = self::get_pdf_font();
     if ($format === null) {
         $format = Base_User_SettingsCommon::get(Libs_TCPDF::module_name(), 'page_format');
     }
     $tcpdf = new TCPDF($orientation, $unit, $format, true);
     $tcpdf->SetCreator(PDF_CREATOR);
     $tcpdf->SetAuthor("Powered by epesi");
     $tcpdf->SetKeywords("PDF");
     // set header and footer fonts
     $tcpdf->setHeaderFont(array(self::$default_font, '', PDF_FONT_SIZE_MAIN));
     $tcpdf->setFooterFont(array(self::$default_font, '', PDF_FONT_SIZE_DATA));
     //set margins
     $tcpdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $tcpdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $tcpdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     //set auto page breaks
     $tcpdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //set image scale factor
     $tcpdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     return $tcpdf;
 }