public function Pdfcreation()
 {
     $USERSTAMP = $this->Mdl_eilib_common_function->getSessionUserStamp();
     $this->load->library('pdf');
     $pdfresult = '';
     $custname = $this->input->get('custname');
     $custid = $this->input->get('custnameid');
     $unitno = $this->input->get('unitno');
     $cardno = $this->input->get('cardno');
     $option = $this->input->get('option');
     $pdfresult = $this->Mdl_access_card_view->Pdf_creation($custid, $unitno, $cardno, $option, $USERSTAMP);
     $pdfheader = '';
     if ($option == 18) {
         $pdfheader = 'ACCESS CARD DETAIL FOR CARD NO ' . $cardno;
     } else {
         if ($option == 21) {
             $pdfheader = 'ACCESS CARD DETAIL FOR CUSTOMER ' . $custname;
         } else {
             if ($option == 31) {
                 $pdfheader = 'ACCESS CARD DETAILS FOR THE UNIT NUMBER ' . $unitno;
             } else {
                 if ($option == 40) {
                     $pdfheader = 'ACCESS CARD DETAILS FOR ALL UNITS';
                 }
             }
         }
     }
     $pdf = $this->pdf->load();
     $pdf = new mPDF('utf-8', 'A4');
     $pdf->SetHTMLHeader('<div style="text-align: center; font-weight: bold;">' . $pdfheader . '</div>', 'O', true);
     $pdf->SetHTMLFooter('<div style="text-align: center;">{PAGENO}</div>');
     $pdf->WriteHTML($pdfresult);
     $pdf->Output($pdfheader . '.pdf', 'D');
 }
 private function printRelatorioHTMLPDF($html)
 {
     $this->getContext()->getConfiguration()->loadHelpers('Partial');
     $mpdf = new mPDF('', 'A4', '', '', 5, 5, 37, 37, 3, 3);
     $mpdf->useOnlyCoreFonts = true;
     // false is default
     $mpdf->SetWatermarkText("PÉROLA NEGRA");
     $mpdf->showWatermarkText = true;
     $mpdf->watermark_font = 'DejaVuSansCondensed';
     $mpdf->watermarkTextAlpha = 0.1;
     $mpdf->SetDisplayMode('fullpage');
     $stylesheet = file_get_contents('css/relatorios.css');
     $mpdf->WriteHTML($stylesheet, 1);
     $mpdf->SetHTMLHeader(utf8_encode(get_partial('header')));
     $mpdf->SetHTMLFooter(utf8_encode(get_partial('footer')));
     $mpdf->SetMargins(0, 0, 65);
     $mpdf->WriteHTML(utf8_encode($html));
     $mpdf->Output();
 }
 /**
  * @param $path
  * @param $print_portrait
  * @param $print_paper_size
  * @param $labels
  * @return bool|string
  */
 public function explodePDF($path, $print_portrait, $print_paper_size, $labels)
 {
     ini_set('memory_limit', '1024M');
     if (!is_file($path)) {
         return false;
     }
     $isPortrait = $print_portrait;
     $paperSize = in_array($print_paper_size, ['A2', 'A3', 'A4', 'A5']) ? $print_paper_size : 'A4';
     $pdfInfo = $this->pdfInfo($path);
     if (!$pdfInfo) {
         return false;
     }
     $pdfSize = array_map(function ($item) {
         return trim((int) $item);
     }, explode('x', $pdfInfo['Page size']));
     $pdfSize['w'] = $pdfSize[0] * 0.75;
     $pdfSize['h'] = $pdfSize[1] * 0.75;
     $paperSizes = ['A2' => ['w' => 420, 'h' => 594], 'A3' => ['w' => 297, 'h' => 420], 'A4' => ['w' => 210, 'h' => 297], 'A5' => ['w' => 148, 'h' => 210]];
     include dirname(__DIR__) . "/lib/mpdf/mpdf.php";
     $mgl = 10;
     $mgr = 10;
     $mgt = 20 + 10;
     $mgb = 5 + 10;
     $mgh = 9;
     $mgf = 9;
     if ($isPortrait) {
         $mgl = 20;
         $mgr = 10;
         $mgt = 5 + 10;
         $mgb = 5 + 10;
         $mgh = 9;
         $mgf = 9;
     }
     $mpdf = new \mPDF('c', $paperSize . ($isPortrait ? '-P' : '-L'));
     $mpdf->SetImportUse();
     $mpdf->SetDisplayMode('fullpage');
     $mpdf->SetCompression(true);
     //$mpdf->SetAutoPageBreak(true);
     $mpdf->mirrorMargins = true;
     $source = $mpdf->SetSourceFile($path);
     $page_w = $isPortrait ? $paperSizes[$paperSize]['w'] : $paperSizes[$paperSize]['h'];
     $page_h = $isPortrait ? $paperSizes[$paperSize]['h'] : $paperSizes[$paperSize]['w'];
     $iter_w = ceil($pdfSize['w'] / $page_w / 2);
     $iter_h = ceil($pdfSize['h'] / $page_h / 1);
     $crop_x = 0;
     $crop_y = 0;
     $head_left = isset($labels['head_left']) ? $labels['head_left'] : '';
     $head_center = isset($labels['head_center']) ? $labels['head_center'] : '';
     $head_right = isset($labels['head_right']) ? $labels['head_right'] : '';
     $footer_left = isset($labels['footer_left']) ? $labels['footer_left'] : '';
     $footer_center = isset($labels['footer_center']) ? $labels['footer_center'] : '';
     $footer_right = isset($labels['footer_right']) ? $labels['footer_right'] : '';
     $header = '
         <table width="100%" style="vertical-align: bottom; font-size: 12pt; font-weight: bold"><tr>
         <td width="33%">' . $head_left . '</td>
         <td width="33%" align="center">' . $head_center . '</td>
         <td width="33%" style="text-align: right;">' . $head_right . '</td>
         </tr></table>
         ';
     $footer = '
         <table width="100%" style="vertical-align: bottom; font-size: 12pt; font-weight: bold"><tr>
         <td width="33%">' . $footer_left . '</td>
         <td width="33%" align="center">' . $footer_center . '</td>
         <td width="33%" style="text-align: right;">' . $footer_right . '</td>
         </tr></table>
         ';
     $mpdf->SetHTMLHeader($header);
     $mpdf->SetHTMLHeader($header, 'E');
     $mpdf->SetHTMLFooter($footer);
     $mpdf->SetHTMLFooter($footer, 'E');
     for ($i = 0; $i < $iter_w; $i++) {
         if ($i > 0) {
             $mpdf->AddPage();
         }
         // '', '', '', '', '', $mgl, $mgr, $mgt, $mgb, $mgh, $mgf
         $tpl = $mpdf->ImportPage($source, $crop_x, $crop_y, $page_w - ($mgl + $mgr), $page_h - ($mgt + $mgb));
         $mpdf->UseTemplate($tpl, $mgl, $mgt);
         if ($iter_h > 2) {
             $mpdf->AddPage();
             $tpl = $mpdf->ImportPage($source, $crop_x, $crop_y, $page_w - ($mgl + $mgr), $page_h - ($mgt + $mgb));
             $mpdf->UseTemplate($tpl, $mgl, $mgt);
         }
         $crop_x += $page_w - ($mgl + $mgr);
     }
     $mpdf->Output($path . 'gen.pdf', 'F');
     return $path . 'gen.pdf';
 }
 public function BankttPdfCreation()
 {
     $UserStamp=$this->Mdl_eilib_common_function->getSessionUserStamp();
     $timeZoneFormat= $this->Mdl_eilib_common_function->getTimezone();
     $option=$_GET['Searchoption'];
     $unit=$_GET['Frominput'];
     $customer=$_GET['Todate'];
     $header=$_GET['Header'];
     $SearchResults=$this->Mdl_ocbc_banktt_entry->Banktt_PDF_SearchResults($option,$UserStamp,$timeZoneFormat,$unit,$customer);
     $this->load->library('pdf');
     $pdf = $this->pdf->load();
     $pdf=new mPDF('utf-8','A4');
     $pdf->SetHTMLHeader('<div style="text-align: center; font-weight: bold;">'.$header.'</div>', 'O', true);
     $pdf->SetHTMLFooter('<div style="text-align: center;">{PAGENO}</div>');
     $pdf->WriteHTML($SearchResults);
     $pdf->Output('BANK TT DETAILS.pdf', 'D');
 }
Example #5
1
function pdf_create($html, $filename, $stream = true, $textoMarcaDagua = null, $path = null, $css = null, $idEmissor = null, $orientacao = null)
{
    $arrayParams = array();
    require_once APPPATH . 'helpers/mpdf/mpdf.php';
    $CI =& get_instance();
    $CI->load->model('comum/empresas_model', 'empresas_model');
    $paramVariaveis = 'relatorio_variaveis_padrao';
    $paramModelo = 'relatorio_modelo_padrao';
    if ($CI->session->userdata('idEmissor') != null) {
        $arrayParams = $CI->empresas_model->getParametros($CI->session->userdata('idEmissor'));
    } elseif ($idEmissor != null) {
        $arrayParams = $CI->empresas_model->getParametros($idEmissor);
    } else {
        $arrayParams = $CI->empresas_model->getParametros($CI->usuariologado->getIdEmpresa());
    }
    $mpdf = new mPDF('c', $orientacao == 'L' ? 'A4-L' : '', 9, 'Verdana', 18, 18, 35, 20, 0, 10, $orientacao);
    $mpdf->SetTitle($filename);
    $mpdf->SetHTMLHeader($CI->load->view('pdfHeader', null, true));
    $mpdf->SetHTMLFooter($CI->load->view('pdfFooter', null, true));
    if (!empty($css)) {
        $mpdf->WriteHTML(file_get_contents($css), 1);
    } else {
        $mpdf->WriteHTML(file_get_contents('assets/css/report.css'), 1);
    }
    if ($textoMarcaDagua != null) {
        $mpdf->SetWatermarkText($textoMarcaDagua);
        $mpdf->showWatermarkText = true;
    }
    $mpdf->WriteHTML($html, 2);
    $mpdf->SetAutoFont();
    if ($path !== '' && $path !== null) {
        if (!file_exists($path)) {
            mkdir($path, 0777, true);
        }
    }
    if ($stream) {
        $mpdf->Output($path . DS . $filename . '.pdf', 'F');
    } else {
        $mpdf->Output();
    }
}
Example #6
1
 /**
  * Generuje PDF, korzysta z bibliotek mPDF
  * @return void
  */
 private function generatePDF()
 {
     require_once $this->getConfig("libDir") . "mpdf" . DS . "mpdf.php";
     $footer = "<p class='footer'> Wyrażam zgodę na przetwarzanie moich danych osobowych dla celów rekrutacji,\r\n        zgodnie z ustawą z dnia 29 sierpnia 1997 r. o ochronie danych osobowych (tj. Dz. U. Nr 101 z 2002 r., poz. 926 z późn. zm.).</p>";
     $pdftemp = $this->getConfig("pdftemp");
     $randomName = mt_rand(1000000, 9999999);
     while (file_exists($pdftemp . $randomName . "." . "pdf")) {
         $randomName = mt_rand(1000000, 9999999);
     }
     $this->_temp['randomPdfName'] = $randomName;
     $mpdf = new mPDF('', '', 0, '', 15, 15, 16, 16, 9, 9);
     $mpdf->SetHTMLFooter($footer);
     $mpdf->WriteHTML($this->_temp['html']);
     $mpdf->Output($pdftemp . $randomName . ".pdf", 'F');
 }
 public function getCuentas()
 {
     $facturas = CuentasxpagarModel::where("estado_activo", "=", 1)->join('proveedores', 'proveedores.id', '=', 'cuentasxpagar.proveedor_id')->groupBy('proveedor_id')->select(DB::raw('count(*) as contador, proveedores.identificacion, proveedores.nombres, Sum(saldo) as monto, proveedor_id'))->orderby('proveedores.nombres')->get();
     $reporte = new Reporte("Cuentas por pagar");
     $filas = "";
     if ($facturas->count() == 0) {
         $tabla = '<div style="text-align:center"><p>Sin datos para mostrar</p></div>';
     } else {
         $cont = 0;
         foreach ($facturas as $item) {
             $cont++;
             $mod = $cont % 2 == 0;
             if ($mod == 1) {
                 $filas .= '<tr>' . '<td style="background: #E8EDFF; color: #1E252B; font-size: 12px; text-align: center;">' . $item->identificacion . '</td>' . '<td style="background: #E8EDFF; color: #1E252B; font-size: 12px; text-align: center;">' . $item->nombres . ' ' . $item->apellidos . '</td>' . '<td style="background: #E8EDFF; color: #1E252B; font-size: 12px; text-align: center;">' . $item->contador . '</td>' . '<td style="background: #E8EDFF; color: #1E252B; font-size: 12px; text-align: center;">' . $item->monto . '</td>' . '</tr>';
             } else {
                 $filas .= '<tr>' . '<td style="background: #F5F5F5; color: #1E252B; font-size: 12px; text-align: center;">' . $item->identificacion . '</td>' . '<td style="background: #F5F5F5; color: #1E252B; font-size: 12px; text-align: center;">' . $item->nombres . '</td>' . '<td style="background: #F5F5F5; color: #1E252B; font-size: 12px; text-align: center;">' . $item->contador . '</td>' . '<td style="background: #F5F5F5; color: #1E252B; font-size: 12px; text-align: center;">' . $item->monto . '</td>' . '</tr>';
             }
         }
         $columnas = array('Identificaci&#243;n', 'Proveedores', 'Facturas', 'Total');
         $tabla = $reporte->getTable($columnas, $filas);
     }
     $mpdf = new \mPDF('utf-8', 'A4', '', '', '15', '15', '28', '18');
     $mpdf->SetTitle("Reporte");
     $mpdf->SetHTMLHeader($reporte->getHeader());
     $mpdf->SetHTMLFooter($reporte->getFooter());
     $mpdf->WriteHTML($tabla);
     $mpdf->Output('reporte.pdf', 'I');
 }
 function getUsuarios()
 {
     $usuarios = User::orderBy('type')->orderBy('name')->get();
     $reporte = new Reporte("Lista de usuarios");
     $filas = "";
     if ($usuarios->count() == 0) {
         $tabla = '<div style="text-align:center"><p>Sin datos para mostrar</p></div>';
     } else {
         $cont = 0;
         foreach ($usuarios as $item) {
             $cont++;
             $mod = $cont % 2 == 0;
             if ($mod == 1) {
                 $filas .= '<tr>' . '<td style="background: #E8EDFF; color: #1E252B; font-size: 12px; text-align: left;">' . $item->name . '</td>' . '<td style="background: #E8EDFF; color: #1E252B; font-size: 12px; text-align: center;">' . $item->username . '</td>' . '<td style="background: #E8EDFF; color: #1E252B; font-size: 12px; text-align: left;">' . $item->email . '</td>' . '<td style="background: #E8EDFF; color: #1E252B; font-size: 12px; text-align: center;">' . $item->type . '</td>' . '</tr>';
             } else {
                 $filas .= '<tr>' . '<td style="background: #F5F5F5; color: #1E252B; font-size: 12px; text-align: left;">' . $item->name . '</td>' . '<td style="background: #F5F5F5; color: #1E252B; font-size: 12px; text-align: center;">' . $item->username . '</td>' . '<td style="background: #F5F5F5; color: #1E252B; font-size: 12px; text-align: left;">' . $item->email . '</td>' . '<td style="background: #F5F5F5; color: #1E252B; font-size: 12px; text-align: center;">' . $item->type . '</td>' . '</tr>';
             }
         }
         $columnas = array('Nombres', 'Usuario', 'Correo', 'Tipo');
         $tabla = $reporte->getTable($columnas, $filas);
     }
     $mpdf = new \mPDF('utf-8', 'A4', '', '', '15', '15', '28', '18');
     $mpdf->SetTitle("Reporte");
     $mpdf->SetHTMLHeader($reporte->getHeader());
     $mpdf->SetHTMLFooter($reporte->getFooter());
     $mpdf->WriteHTML($tabla);
     $mpdf->Output('reporte.pdf', 'I');
 }
Example #9
0
 public function _gen_pdf_transkrip($html, $paper, $layoutpage)
 {
     ob_end_clean();
     ini_set('memory_limit', '500000M');
     $mpdf = new mPDF('utf-8', $paper, '', '', 15, 15, 15, 15, 0, 5);
     $mpdf->debug = false;
     $mpdf->SetDisplayMode('fullpage');
     /*$footer = array (
     		  'odd' => array (
     		    'C' => array (
     		      'content' => 'Transkrip Akademik ini SAH bila tercetak pada kertas dengan latar belakang LOGO POLTEK AKA dan bukan Photo Copy',
     		      'font-size' => 8,
     		      'font-style' => '',
     		      'font-family' => 'Opensas',
     		      'color'=>'#000000'
     		    ),
     		    )
     		  );
     
     		 $mpdf->SetFooter($footer); */
     $mpdf->AddPage($layoutpage);
     $mpdf->WriteHTML($html);
     $mpdf->SetHTMLFooter('<div style="text-align:center;font-size:10px;font-family:opensans;">Transkrip Akademik ini SAH bila tercetak pada kertas dengan latar belakang LOGO POLTEK AKA dan bukan Photo Copy</div>');
     $mpdf->Output();
 }
 function getClientes()
 {
     $clientes = Clientes::orderBy('nombres')->orderBy('apellidos')->get();
     $reporte = new Reporte("Lista de clientes");
     $filas = "";
     if ($clientes->count() == 0) {
         $tabla = '<div style="text-align:center"><p>Sin datos para mostrar</p></div>';
     } else {
         $cont = 0;
         foreach ($clientes as $item) {
             $cont++;
             $mod = $cont % 2 == 0;
             if ($mod == 1) {
                 $filas .= '<tr>' . '<td style="background: #E8EDFF; color: #1E252B; font-size: 12px; text-align: center;">' . $item->identificacion . '</td>' . '<td style="background: #E8EDFF; color: #1E252B; font-size: 12px; text-align: left;">' . $item->nombres . '</td>' . '<td style="background: #E8EDFF; color: #1E252B; font-size: 12px; text-align: left;">' . $item->apellidos . '</td>' . '<td style="background: #E8EDFF; color: #1E252B; font-size: 12px; text-align: left;">' . $item->correo . '</td>' . '<td style="background: #E8EDFF; color: #1E252B; font-size: 12px; text-align: left;">' . $item->direccion . '</td>' . '<td style="background: #E8EDFF; color: #1E252B; font-size: 12px; text-align: center;">' . $item->telefono . '</td>' . '</tr>';
             } else {
                 $filas .= '<tr>' . '<td style="background: #F5F5F5; color: #1E252B; font-size: 12px; text-align: center;">' . $item->identificacion . '</td>' . '<td style="background: #F5F5F5; color: #1E252B; font-size: 12px; text-align: left;">' . $item->nombres . '</td>' . '<td style="background: #F5F5F5; color: #1E252B; font-size: 12px; text-align: left;">' . $item->apellidos . '</td>' . '<td style="background: #F5F5F5; color: #1E252B; font-size: 12px; text-align: left;">' . $item->correo . '</td>' . '<td style="background: #F5F5F5; color: #1E252B; font-size: 12px; text-align: left;">' . $item->direccion . '</td>' . '<td style="background: #F5F5F5; color: #1E252B; font-size: 12px; text-align: center;">' . $item->telefono . '</td>' . '</tr>';
             }
         }
         $columnas = array('Identificaci&#243;n', 'Nombres', 'Apellidos', 'Correo', 'Direcci&#243;n', 'Tel&#233;fono');
         $tabla = $reporte->getTable($columnas, $filas);
     }
     $mpdf = new \mPDF('utf-8', 'A4-L', '', '', '15', '15', '28', '18');
     $mpdf->SetTitle("Reporte");
     $mpdf->SetHTMLHeader($reporte->getHeader());
     $mpdf->SetHTMLFooter($reporte->getFooter());
     $mpdf->WriteHTML($tabla);
     $mpdf->Output('reporte.pdf', 'I');
 }
 /**
  * Generates the invoice with MPDF lib.
  * @param $dest
  * @return string
  */
 protected function generate($html_sections, $dest, $paid)
 {
     set_time_limit(0);
     $mpdf_filename = BEWPI_LIB_DIR . 'mpdf/mpdf.php';
     include $mpdf_filename;
     $mpdf_options = $this->get_mpdf_options();
     $mpdf = new mPDF($mpdf_options['mode'], $mpdf_options['format'], $mpdf_options['default_font_size'], $mpdf_options['default_font'], $mpdf_options['margin_left'], $mpdf_options['margin_right'], $mpdf_options['margin_top'], $mpdf_options['margin_bottom'], $mpdf_options['margin_header'], $mpdf_options['margin_footer'], $mpdf_options['orientation']);
     $mpdf->useOnlyCoreFonts = false;
     // false is default
     if ((bool) $this->template_options['bewpi_show_payment_status'] && $paid) {
         $mpdf->SetWatermarkText(__('Paid', 'woocommerce-pdf-invoices'));
         $mpdf->showWatermarkText = true;
     }
     $mpdf->SetDisplayMode('fullpage');
     //$mpdf->useSubstitutions = true;
     $mpdf->autoScriptToLang = true;
     $mpdf->autoLangToFont = true;
     $mpdf->setAutoTopMargin = 'stretch';
     $mpdf->setAutoBottomMargin = 'stretch';
     $mpdf->autoMarginPadding = 10;
     //$mpdf->debug = true;
     //$mpdf->showImageErrors = true;
     if (!empty($html_sections['header'])) {
         $mpdf->SetHTMLHeader($html_sections['header']);
     }
     if (!empty($html_sections['footer'])) {
         $mpdf->SetHTMLFooter($html_sections['footer']);
     }
     $mpdf->WriteHTML($html_sections['style'] . $html_sections['body']);
     $mpdf = apply_filters('bewpi_mpdf', $mpdf);
     $mpdf->Output($dest === 'F' ? $this->full_path : $this->filename, $dest);
 }
Example #12
0
 public function getMpdfInstance()
 {
     $mpdf = new \mPDF($this->options['encoding'], $this->options['format'], $this->options['font-size'], $this->options['font'], $this->options['margin-left'], $this->options['margin-right'], $this->options['margin-top'], $this->options['margin-bottom'], $this->options['margin-header'], $this->options['margin-footer'], $this->options['orientation']);
     if ($this->footer !== NULL) {
         $mpdf->SetHTMLFooter($this->footer);
     }
     if ($this->header !== NULL) {
         $mpdf->SetHTMLHeader($this->header);
     }
     return $mpdf;
 }
 public function DCSU_tablepdf(){
     $timeZoneFrmt= $this->Mdl_eilib_common_function->getTimezone();
     $unitno=$this->input->get("DCSUunitno");
     $pdfresult=$this->Mdl_unit_door_code_search_update->DCSU_table_pdf($unitno,$timeZoneFrmt);
     $pdfheader='DOOR CODE LOGIN DETAILS FOR THE UNIT NUMBER '.$unitno;
     $this->load->library('pdf');
     $pdf = $this->pdf->load();
     $pdf=new mPDF('utf-8','A4');
     $pdf->SetHTMLHeader('<div style="text-align: center; font-weight: bold;">'.$pdfheader.'</div>', 'O', true);
     $pdf->SetHTMLFooter('<div style="text-align: center;">{PAGENO}</div>');
     $pdf->WriteHTML($pdfresult);
     $pdf->Output($pdfheader.'.pdf', 'D');
 }
 public function ModelPdfCreation()
 {
     $header=$_GET['Header'];
     $timeZoneFormat= $this->Mdl_eilib_common_function->getTimezone();
     $AllmodelDetails=$this->Mdl_ocbc_model_entry_search_update->PDF_AllModels_Details($timeZoneFormat);
     $this->load->library('pdf');
     $pdf = $this->pdf->load();
     $pdf=new mPDF('utf-8','A4');
     $pdf->SetHTMLHeader('<div style="text-align: center; font-weight: bold;">'.$header.'</div>', 'O', true);
     $pdf->SetHTMLFooter('<div style="text-align: center;">{PAGENO}</div>');
     $pdf->WriteHTML($AllmodelDetails);
     $pdf->Output($header.'.pdf', 'D');
 }
Example #15
0
 public function OCBCPdfCreation()
 {
     $Period=$_GET['Period'];
     $SubmittedData=$this->Mdl_ocbc_ocbc->OCBC_PDF_Creation($Period);
     $header='OCBC RECORDS-'.strtoupper($Period);
     $this->load->library('pdf');
     $pdf = $this->pdf->load();
     $pdf=new mPDF('utf-8','A4');
     $pdf->SetHTMLHeader('<div style="text-align: center; font-weight: bold;">'.$header.'</div>', 'O', true);
     $pdf->SetHTMLFooter('<div style="text-align: center;">{PAGENO}</div>');
     $pdf->WriteHTML($SubmittedData);
     $pdf->Output($header.'.pdf', 'D');
 }
 public function User_Details_pdf(){
     $UserStamp=$this->Mdl_eilib_common_function->getSessionUserStamp();
     $timeZoneFormat=$this->Mdl_eilib_common_function->getTimezone();
     $this->load->library('pdf');
     $pdfresult='';
     $pdfresult=$this->Mdl_access_rights_user_search_details->User_Details_pdf($timeZoneFormat);
     $pdfheader='USER SEARCH DETAILS';
     $pdf = $this->pdf->load();
     $pdf=new mPDF('utf-8','A4');
     $pdf->SetHTMLHeader('<div style="text-align: center; font-weight: bold;">'.$pdfheader.'</div>', 'O', true);
     $pdf->SetHTMLFooter('<div style="text-align: center;">{PAGENO}</div>');
     $pdf->WriteHTML($pdfresult);
     $pdf->Output($pdfheader.'.pdf', 'D');
 }
    public  function EMPLOYEE_pdf(){

        $timeZoneFormat=$this->Mdl_eilib_common_function->getTimezone();
        $this->load->library('pdf');
        $pdfresult='';
        $pdfresult=$this->Mdl_staff_employee_entry_search_update_delete->Employee_pdf($timeZoneFormat,$_GET['EMPSRC_UPD_DEL_lb_designation_listbox'],$_GET['emp_first_name'],$_GET['emp_last_name'],$_GET['EMPSRC_UPD_DEL_ta_mobile'],$_GET['EMPSRC_UPD_DEL_lb_employeename_listbox'],$_GET['EMPSRC_UPD_DEL_lb_searchoption'],$_GET['EMPSRC_UPD_DEL_ta_email'],$_GET['EMPSRC_UPD_DEL_ta_comments']);
        $header=$_GET['header'];
        $pdfheader=$header;//'TICKLER HISTORY FOR CUSTOMER:'.$TH_fname.' '.$TH_lname;
        $pdf = $this->pdf->load();
        $pdf=new mPDF('utf-8','A4');
        $pdf->SetHTMLHeader('<div style="text-align: center; font-weight: bold;">'.$pdfheader.'</div>', 'O', true);
        $pdf->SetHTMLFooter('<div style="text-align: center;">{PAGENO}</div>');
        $pdf->WriteHTML($pdfresult);
        $pdf->Output($pdfheader.'.pdf', 'D');
    }
 public function ChequePdfCreation()
 {
     $timeZoneFormat= $this->Mdl_eilib_common_function->getTimezone();
     $Option=$_GET['Searchoption'];
     $Data1=$_GET['Frominput'];
     $Data2=$_GET['Todate'];
     $header=$_GET['Header'];
     $Allrecords=$this->Mdl_ocbc_cheque_entry_search_update->ChequePDFCreation($Option,$Data1,$Data2,$timeZoneFormat);
     $this->load->library('pdf');
     $pdf = $this->pdf->load();
     $pdf=new mPDF('utf-8','A4');
     $pdf->SetHTMLHeader('<div style="text-align: center; font-weight: bold;">'.$header.'</div>', 'O', true);
     $pdf->SetHTMLFooter('<div style="text-align: center;">{PAGENO}</div>');
     $pdf->WriteHTML($Allrecords);
     $pdf->Output('CHEQUE DETAILS.pdf', 'D');
 }
Example #19
0
 function pdf_create($html_data, $file_name = "")
 {
     ini_set("memory_limit", "1000M");
     require 'mpdf/mpdf.php';
     //$mypdf = new mPDF("a4");
     $mypdf = new mPDF('', 'A4', '', '', '18', '12', '12', '12', '', '5');
     // ('', 'A4', '', '', $margin_left, $margin_right, $margin_top, $margin_bottom, $margin_header, $margin_footer)
     $footer = "<hr><div style='font-size:7pt;' align='center'>Head Office : Jl Terusan Buah Batu No. 12 Bandung  Telp +62-22-88884388  Fax +62-22-88884422</div>";
     $mypdf->SetHTMLFooter($footer);
     $stylesheet = file_get_contents(base_url() . 'assets/css/style-surat.css');
     $mypdf->WriteHTML($stylesheet, 1);
     $mypdf->WriteHTML($html_data);
     // $mypdf->Output($file_name . '.pdf', 'D');
     $new_filename = str_replace("/", "_", $file_name);
     $file_to_save = FCPATH . 'assets/surat_acara/' . $new_filename . '.pdf';
     $mypdf->Output($file_to_save, 'F');
 }
Example #20
0
 static function mpdfGenerator_Html2PDF($params = array())
 {
     $translate = Zend_Registry::get('Zend_Translate');
     //-----------------------------
     if (!$params['pdfReport'] || !$params['html']) {
         throw new Exception($translate->_('ERR_CREATE_PDF_REPORT'));
     }
     $mode = '';
     // Получим URLLogoReport
     $config = Zend_Registry::get('config');
     $urlLogoReport = $config['user']['main']['logo_report'];
     $urlLogoReport = self::getFullURL_Res($urlLogoReport);
     //------------------------------------------------------
     // Установим значения по умолчанию
     $defaults = array('pdfReport' => '', 'html' => '', 'isCommonFont' => FALSE, 'pathStylesheet' => 'css/report/mpdf-style.css', 'isHeaders' => TRUE, 'isFooters' => TRUE, 'mirrorMargins' => TRUE, 'headerLeftMargin' => '', 'headerCentreMargin' => $urlLogoReport, 'headerRightMargin' => '{PAGENO}/{nbpg}', 'footerLeftMargin' => '{DATE Y-m-j}', 'footerCentreMargin' => '', 'footerRightMargin' => '', 'pageFormat' => 'A4');
     // Обьединим два массива
     $params = array_merge($defaults, $params);
     if (!$params['footerRightMargin']) {
         $params['footerRightMargin'] = self::getFullUrl_For_FilePDF($params['pdfReport']);
     }
     // Установим значения переменных из массива
     //        extract($params, EXTR_OVERWRITE);
     try {
         // Изменим параметры PHP
         self::iniSetConfig_PHP(array("memory_limit" => "500M", "max_execution_time" => "300"));
         //            require_once("mpdf_source.php");
         require_once "mpdf.php";
         if ($params['isCommonFont']) {
             $mode = 'c';
         }
         $isHeaders = (bool) $params['isHeaders'];
         $isFooters = (bool) $params['isFooters'];
         if ($isHeaders || $isFooters) {
             $mpdf = new mPDF($mode, $params['pageFormat'], '', '', 15, 15, 32, 20, 10, 10);
         } else {
             $mpdf = new mPDF($mode, $params['pageFormat']);
         }
         // Установим параметры для оптимизации (уменьшим время испольнения и используемую память)
         $mpdf->useOnlyCoreFonts = true;
         $mpdf->useSubstitutions = false;
         $mpdf->simpleTables = true;
         // Уменьшает время выполнения
         $mpdf->packTableData = true;
         // Уменьшает используемую память
         $mpdf->use_kwt = true;
         //Keep-with-table  Оставить заголовок таблицы вместе с маблицей на одной странице
         //            $mpdf->shrink_tables_to_fit=0;
         //            $mpdf->hyphenate = true;
         //            $mpdf->SHYlang = 'ru';
         //            $mpdf->SHYleftmin = 3;
         // Определим заголовок страницы
         $header = " \n            <table width=\"100%\" style=\"border-bottom: 1px solid #000000; vertical-align: bottom;  font-weight: bold; font-size: 14pt; color: #000088;\"><tr>\n            <td width=\"33%\"><span style=\"\">{$params['headerLeftMargin']}</span></td>\n            <td width=\"33%\" align=\"center\"><img src=\"{$params['headerCentreMargin']}\" /></td>\n            <td width=\"33%\" style=\"text-align: right;\"><span style=\"\">{$params['headerRightMargin']}</span></td>\n            </tr></table>\n            ";
         // Определим подвал страницы
         $footer = "\n            <table width=\"100%\" style=\"vertical-align: bottom;  font-size: 14pt; color: #000088; font-weight: bold; font-style: italic;\"><tr>\n            <td width=\"33%\"><span style=\"\">{$params['footerLeftMargin']}</span></td>\n            <td width=\"33%\" align=\"center\" style=\"\">{$params['footerCentreMargin']}</td>\n            <td width=\"33%\" style=\"text-align: right; \">{$params['footerRightMargin']}</td>\n            </tr></table>\n            ";
         if ($mirrorMargins) {
             $headerE = "\n                <table width=\"100%\" style=\"border-bottom: 1px solid #000000; vertical-align: bottom;  font-weight: bold; font-size: 14pt; color: #000088;\"><tr>\n                <td width=\"33%\"><span style=\"\"><span style=\"\">{$params['headerRightMargin']}</span></span></td>\n                <td width=\"33%\" align=\"center\"><img src=\"{$params['headerCentreMargin']}\" /></td>\n                <td width=\"33%\" style=\"text-align: right;\"><span style=\"\">{$params['headerLeftMargin']}</span></td>\n                </tr></table>\n                ";
             $footerE = "\n                <table width=\"100%\" style=\"vertical-align: bottom;  font-size: 14pt; color: #000088; font-weight: bold; font-style: italic;\"><tr>\n                <td width=\"33%\"><span style=\"\">{$params['footerRightMargin']}</span></td>\n                <td width=\"33%\" align=\"center\" style=\"\">{$params['footerCentreMargin']}</td>\n                <td width=\"33%\" style=\"text-align: right; \">{$params['footerLeftMargin']}</td>\n                </tr></table>\n                ";
             if ($isHeaders) {
                 $mpdf->mirrorMargins = TRUE;
                 // Use different Odd/Even headers and footers and mirror margins
                 $mpdf->SetHTMLHeader($headerE, 'E');
             }
             if ($isFooters) {
                 $mpdf->mirrorMargins = TRUE;
                 // Use different Odd/Even headers and footers and mirror margins
                 $mpdf->SetHTMLFooter($footerE, 'E');
             }
         }
         if ($isHeaders) {
             $mpdf->SetHTMLHeader($header);
         }
         if ($isFooters) {
             $mpdf->SetHTMLFooter($footer);
         }
         $html = $params['html'];
         //$html = '';
         //$params['pathStylesheet'] = '';
         if ($params['pathStylesheet']) {
             $stylesheet = file_get_contents($params['pathStylesheet']);
             $mpdf->WriteHTML($stylesheet, 1);
             $mpdf->WriteHTML($html, 2);
         } else {
             $mpdf->WriteHTML($html);
         }
         // Получим директорию сохранения файлов
         $dirFilePDF = self::getPath_For_FilePDF($params['pdfReport']);
         // Сохраним файл на серверном ресурсе пользователя
         $mpdf->Output($dirFilePDF, 'F');
     } catch (Exception $exc) {
         throw new Exception($exc->getMessage());
     }
     // Возвратим URL путь, полученного файла PDF
     return Default_Plugin_SysBox::getFullUrl_For_FilePDF($params['pdfReport']);
 }
        $parts[1] = substr($parts[1], $tcount);
    }
    $text .= $parts[1];
}
$converted = templateParser::parse_template($text, $object_arr);
$header = templateParser::parse_template($header, $object_arr);
$footer = templateParser::parse_template($footer, $object_arr);
$printable = str_replace("\n", "<br />", $converted);
if ($task == 'pdf' || $task == 'emailpdf') {
    $file_name = $mod_strings['LBL_PDF_NAME'] . "_" . str_replace(" ", "_", $module->name) . ".pdf";
    ob_clean();
    try {
        $pdf = new mPDF('en', 'A4', '', 'DejaVuSansCondensed', 15, 15, 16, 16, 8, 8);
        $pdf->setAutoFont();
        $pdf->SetHTMLHeader($header);
        $pdf->SetHTMLFooter($footer);
        $pdf->writeHTML($printable);
        if ($task == 'pdf') {
            $pdf->Output($file_name, "D");
        } else {
            $fp = fopen($sugar_config['upload_dir'] . 'attachfile.pdf', 'wb');
            fclose($fp);
            $pdf->Output($sugar_config['upload_dir'] . 'attachfile.pdf', 'F');
            sendEmail::send_email($module, $module_type, '', $file_name, true);
        }
    } catch (mPDF_exception $e) {
        echo $e;
    }
} else {
    if ($task == 'email') {
        sendEmail::send_email($module, $module_type, $printable, '', false);
Example #22
0
<td width="65%" align="right">
    <span>พีเอส ซัพพลาย</span> 
    <span>อาคารคอมพิวเตอร์พลาซ่า ห้อง A12</span> <br>
    <span>312 ถ.มณีนพรัตน์ ต.ศรีภูมิ อ.เมือง จ.เชียงใหม่ 50200</span><br>
    <span>Tel. 094-6071991 Fax. 053-405399</span><br>
</td>
</tr></table>
';
$footer = '<table width="100%" style="border-top: 1px solid #000000; vertical-align: bottom; font-size: 9pt; color: #000088;"><tr>
<td width="33%"></td>
<td width="33%" align="center">หน้า {PAGENO}</td>
<td width="33%" style="text-align: right;"></td>
</tr></table>';
$mpdf->SetHTMLHeader($header);
$mpdf->SetHTMLHeader($header, E);
$mpdf->SetHTMLFooter($footer);
$mpdf->SetHTMLFooter($footer, E);
$html = '<table style="width:100%; padding:10px 0 10px 0;">';
$html .= '<tr><td style="width:50%; font-size:20px; font-weight:bold;">ใบแจ้งซ่อม</td>';
$html .= '<td width="50%" align="right">เลขที่ RP-' . $r['rp_id'] . '<br>เมื่อ ' . formatDateThaiFromDatatime($r['rp_datekey']) . ' น.</td></tr>';
$html .= '</table><hr>';
$html .= '<div style="float: left; width: 49%;"><table style="width:100%;">';
$html .= '<tr><td style="width:100%; font-weight:bold; text-decoration: underline;" colspan="2">ข้อมูลลูกค้า</td></tr>';
$html .= '<tr><td style="font-weight:bold; width:35%;">ชื่อลูกค้า </td><td>: ' . $r['c_flname'] . '</td></tr>
<tr><td style="font-weight:bold;">เลขที่ประชาชน </td><td>: ' . $r['c_cradid'] . '</td></tr>
<tr><td style="font-weight:bold;">E-mail </td><td>: ' . $r['c_email'] . '</td></tr>
<tr><td style="font-weight:bold;">เบอร์โทรศัพ </td><td>: ' . $r['c_phone'] . '</td></tr></table></div>';
$html .= '<div style="float: right; width: 49%;"><table style="width:100%;">
<tr><td style="width:100%; font-weight:bold; text-decoration: underline;" colspan="2">ข้อมูลเครื่อง</td></tr>
<tr><td style="font-weight:bold; width:35%;">ยี่ห้อเครื่อง </td><td>: ' . $r['rp_brand'] . '</td></tr>
<tr><td style="font-weight:bold;">หมายเลขเครื่อง </td><td>: ' . $r['rp_numberproduct'] . '</td></tr>
Example #23
0
    $xx13 = "4";
} else {
    $xx13 = "";
}
if ($xx13 != "") {
    $xx14 = $xx11 . "_" . $xx10;
    $xx15 = new PDFContent($xx13, $xx11, $xx12, $_REQUEST["language"]);
    $xx16 = $xx15->getContent();
    $xx17 = $xx15->getSettings();
    $xx18 = $xx1d($xx16["header"], ENT_COMPAT, "utf-8");
    $xx19 = $xx1d($xx16["body"], ENT_COMPAT, "utf-8");
    $xx1a = $xx1d($xx16["footer"], ENT_COMPAT, "utf-8");
    if ($xx17["orientation"] == "landscape") {
        $xx1b = $xx17["format"] . "-L";
    } else {
        $xx1b = $xx17["format"];
    }
    if (!isset($xx1c)) {
        $xx1c = new mPDF('', $xx1b, '', 'Arial', $xx17["margin_left"], $xx17["margin_right"], 0, 0, $xx17["margin_top"], $xx17["margin_bottom"]);
        $xx1c->SetAutoFont();
        @$xx1c->SetHTMLHeader($xx18);
    } else {
        @$xx1c->SetHTMLHeader($xx18);
        @$xx1c->WriteHTML('<pagebreak sheet-size="' . $xx1b . '" margin-left="' . $xx17["margin_left"] . 'mm" margin-right="' . $xx17["margin_right"] . 'mm" margin-top="0mm" margin-bottom="0mm" margin-header="' . $xx17["margin_top"] . 'mm" margin-footer="' . $xx17["margin_bottom"] . 'mm" />');
    }
    @$xx1c->SetHTMLFooter($xx1a);
    @$xx1c->WriteHTML($xx19);
    $xx1c->Output('storage/' . $xx14 . '.pdf');
}
echo "<script>window.history.back();</script>";
exit;
<table width="100%" style="border-bottom: 1px solid #000000; vertical-align: bottom; font-family: serif; font-size: 9pt; color: #000088;"><tr>
<td width="33%">Left header p <span style="font-size:14pt;">{PAGENO}</span></td>
<td width="33%" align="center"><img src="sunset.jpg" width="126px" /></td>
<td width="33%" style="text-align: right;"><span style="font-weight: bold;">Right header</span></td>
</tr></table>
';
$headerE = '
<table width="100%" style="border-bottom: 1px solid #000000; vertical-align: bottom; font-family: serif; font-size: 9pt; color: #000088;"><tr>
<td width="33%"><span style="font-weight: bold;">Outer header</span></td>
<td width="33%" align="center"><img src="sunset.jpg" width="126px" /></td>
<td width="33%" style="text-align: right;">Inner header p <span style="font-size:14pt;">{PAGENO}</span></td>
</tr></table>
';
$footer = '<div align="center">See <a href="http://mpdf1.com/manual/index.php">documentation manual</a></div>';
$footerE = '<div align="center">See <a href="http://mpdf1.com/manual/index.php">documentation manual</a></div>';
$mpdf->SetHTMLHeader($header);
$mpdf->SetHTMLHeader($headerE, 'E');
$mpdf->SetHTMLFooter($footer);
$mpdf->SetHTMLFooter($footerE, 'E');
$html = '
<h1>mPDF</h1>
<h2>Headers & Footers Method 2</h2>
<h3>Odd / Right page</h3>
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
<pagebreak />
<h3>Even / Left page</h3>
<p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
';
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
 public function get_payment_area()
 {
     $start_date = $this->input->get_post('start_date');
     $end_date = $this->input->get_post('end_date');
     $this->data['payment_info'] = $this->report->getDepotToAllCustomerPaymentReport($this->ion_auth->get_user_id(), $start_date, $end_date);
     if ($this->input->is_ajax_request()) {
         $this->load->view(BACKEND . '/report/payment/generate', $this->data);
     } else {
         //load mPDF library
         $this->load->library('m_pdf');
         $pdf = $this->m_pdf->load();
         $mpdf = new mPDF('c', 'A4', '', '', 20, 15, 38, 25, 10, 10);
         $mpdf->SetProtection(array('print'));
         $mpdf->SetTitle("Walart Pharmaceutical. - Payment Report");
         $mpdf->SetAuthor("Walart Pharmaceutical.");
         $mpdf->SetDisplayMode('fullpage');
         $header = $this->load->view(BACKEND . '/report/payment/generate/header', $this->data, true);
         $footer = $this->load->view(BACKEND . '/report/payment/generate/footer', $this->data, true);
         $html = $this->load->view(BACKEND . '/report/payment/generate', $this->data, true);
         $mpdf->SetHTMLHeader($header);
         $mpdf->SetHTMLFooter($footer);
         $mpdf->WriteHTML($html);
         $mpdf->Output($pdfFilePath, "D");
     }
 }
function pdf_create($html, $filename, $stream = TRUE, $password = NULL, $isInvoice = NULL, $isGuest = NULL)
{
    require_once APPPATH . 'helpers/mpdf/mpdf.php';
    $mpdf = new mPDF();
    $mpdf->useAdobeCJK = true;
    $mpdf->SetAutoFont();
    $mpdf->SetProtection(array('copy', 'print'), $password, $password);
    if (!(is_dir('./uploads/archive/') or is_link('./uploads/archive/'))) {
        mkdir('./uploads/archive/', '0777');
    }
    $CI =& get_instance();
    if ((strpos($filename, lang('invoice')) !== false or strpos($filename, lang('quote')) !== false) && !empty($CI->mdl_settings->settings['pdf_invoice_footer'])) {
        $mpdf->setAutoBottomMargin = 'stretch';
        $footerHTML = '<div id="footer">' . $CI->mdl_settings->settings['pdf_invoice_footer'] . '</div>';
        $footerHTML .= '<div class="footer-including-page-number">' . lang('page') . ' {PAGENO} / {nb}</div>';
        $mpdf->SetHTMLFooter($footerHTML);
    } else {
        $mpdf->SetHTMLFooter('<div id="footer" class="footer-including-page-number">' . lang('page') . ' {PAGENO} / {nb}</div>');
    }
    $invoice_array = array();
    $mpdf->WriteHTML($html);
    if ($stream) {
        if (!$isInvoice) {
            return $mpdf->Output($filename . '.pdf', 'I');
        }
        foreach (glob('./uploads/archive/*' . $filename . '.pdf') as $file) {
            array_push($invoice_array, $file);
        }
        if (!empty($invoice_array) and $isGuest) {
            rsort($invoice_array);
            header('Content-type: application/pdf');
            return readfile($invoice_array[0]);
        } else {
            if ($isGuest) {
                //todo flashdata is deleted between requests
                //$CI->session->flashdata('alert_error', 'sorry no Invoice found!');
                redirect('guest/view/invoice/' . end($CI->uri->segment_array()));
            }
        }
        $mpdf->Output('./uploads/archive/' . date('Y-m-d') . '_' . $filename . '.pdf', 'F');
        return $mpdf->Output($filename . '.pdf', 'I');
    } else {
        if ($isInvoice) {
            foreach (glob('./uploads/archive/*' . $filename . '.pdf') as $file) {
                array_push($invoice_array, $file);
            }
            if (!empty($invoice_array) && !is_null($isGuest)) {
                rsort($invoice_array);
                return $invoice_array[0];
            }
            $mpdf->Output('./uploads/archive/' . date('Y-m-d') . '_' . $filename . '.pdf', 'F');
            return './uploads/archive/' . date('Y-m-d') . '_' . $filename . '.pdf';
        }
        $mpdf->Output('./uploads/temp/' . $filename . '.pdf', 'F');
        // DELETE OLD TEMP FILES - Housekeeping
        // Delete any files in temp/ directory that are >1 hrs old
        $interval = 3600;
        if ($handle = @opendir(preg_replace('/\\/$/', '', './uploads/temp/'))) {
            while (false !== ($file = readdir($handle))) {
                if ($file != ".." && $file != "." && !is_dir($file) && filemtime('./uploads/temp/' . $file) + $interval < time() && substr($file, 0, 1) !== '.' && $file != 'remove.txt') {
                    // mPDF 5.7.3
                    unlink('./uploads/temp/' . $file);
                }
            }
            closedir($handle);
        }
        //==============================================================================================================
        return './uploads/temp/' . $filename . '.pdf';
    }
}
Example #27
0
 public function generate_pdf($content, $name = 'download.pdf', $output_type = NULL, $footer = NULL, $margin_bottom = NULL, $header = NULL, $margin_top = NULL, $orientation = 'P')
 {
     if (!$output_type) {
         $output_type = 'D';
     }
     if (!$margin_bottom) {
         $margin_bottom = 10;
     }
     if (!$margin_top) {
         $margin_top = 10;
     }
     $this->load->library('pdf');
     $pdf = new mPDF('utf-8', 'A4-' . $orientation, '13', '', 10, 10, $margin_top, $margin_bottom, 9, 9);
     $pdf->debug = false;
     $pdf->autoScriptToLang = true;
     $pdf->autoLangToFont = true;
     $pdf->SetProtection(array('print'));
     // You pass 2nd arg for user password (open) and 3rd for owner password (edit)
     //$pdf->SetProtection(array('print', 'copy')); // Comment above line and uncomment this to allow copying of content
     $pdf->SetTitle($this->Settings->site_name);
     $pdf->SetAuthor($this->Settings->site_name);
     $pdf->SetCreator($this->Settings->site_name);
     $pdf->SetDisplayMode('fullpage');
     $stylesheet = file_get_contents('assets/bs/bootstrap.min.css');
     $pdf->WriteHTML($stylesheet, 1);
     $pdf->WriteHTML($content);
     if ($header != '') {
         $pdf->SetHTMLHeader('<p class="text-center">' . $header . '</p>', '', TRUE);
     }
     if ($footer != '') {
         $pdf->SetHTMLFooter('<p class="text-center">' . $footer . '</p>', '', TRUE);
     }
     //$pdf->SetHeader($this->Settings->site_name.'||{PAGENO}', '', TRUE); // For simple text header
     //$pdf->SetFooter($this->Settings->site_name.'||{PAGENO}', '', TRUE); // For simple text footer
     if ($output_type == 'S') {
         $file_content = $pdf->Output('', 'S');
         write_file('assets/uploads/' . $name, $file_content);
         return 'assets/uploads/' . $name;
     } else {
         $pdf->Output($name, $output_type);
     }
 }
    public  function Staff_Detail_pdf(){

        $timeZoneFormat=$this->Mdl_eilib_common_function->getTimezone();
        $this->load->library('pdf');
        $pdfresult='';
        $STDTL_SEARCH_cpfnumber=$_GET['STDTL_SEARCH_cpfnumber'];
        $STDTL_SEARCH_staffexpense_selectquery=$_GET['STDTL_SEARCH_staffexpense_selectquery'];
        $STDTL_SEARCH_cpffrom_form=$_GET['STDTL_SEARCH_cpffrom_form'];
        $STDTL_SEARCH_cpfto_form=$_GET['STDTL_SEARCH_cpfto_form'];
        $STDTL_SEARCH_staffcommentstxt=$_GET['STDTL_SEARCH_staffcommentstxt'];
        $emp_first_name=$_GET['emp_first_name'];
        $emp_last_name=$_GET['emp_last_name'];
        $pdfresult = $this->Mdl_staff_detail_entry_search_update_delete->Staff_Detail_pdf($STDTL_SEARCH_staffexpense_selectquery,$STDTL_SEARCH_cpfnumber,$STDTL_SEARCH_cpffrom_form,$STDTL_SEARCH_cpfto_form,$STDTL_SEARCH_staffcommentstxt,$emp_first_name,$emp_last_name);//$timeZoneFormat,$_GET['EMPSRC_UPD_DEL_lb_designation_listbox'],$_GET['emp_first_name'],$_GET['emp_last_name'],$_GET['EMPSRC_UPD_DEL_ta_mobile'],$_GET['EMPSRC_UPD_DEL_lb_employeename_listbox'],$_GET['EMPSRC_UPD_DEL_lb_searchoption'],$_GET['EMPSRC_UPD_DEL_ta_email'],$_GET['EMPSRC_UPD_DEL_ta_comments']);
        $header=$_GET['header'];
        $header= str_replace("^","&",$header);
        $pdfheader=$header;//'TICKLER HISTORY FOR CUSTOMER:'.$TH_fname.' '.$TH_lname;
        $pdf = $this->pdf->load();
        $pdf=new mPDF('utf-8','A4-L');
        $pdf->SetHTMLHeader('<div style="text-align: center; font-weight: bold;">'.$pdfheader.'</div>', 'O', true);
        $pdf->SetHTMLFooter('<div style="text-align: center;">{PAGENO}</div>');
        $pdf->WriteHTML($pdfresult);
        $pdf->Output($pdfheader.'.pdf', 'D');
        $data=$this->Mdl_staff_daily_entry_search_update_delete->Staff_Daily_pdf();
        echo json_encode($data);



    }
 public function Customer_Expiry_List_pdf(){
     $UserStamp=$this->Mdl_eilib_common_function->getSessionUserStamp();
     $timeZoneFormat=$this->Mdl_eilib_common_function->getTimezone();
     $this->load->library('pdf');
     $pdfresult='';
     $CEXP_fromdate=$this->input->get('CEXP_fromdate');
     $CEXP_todate=$this->input->get('CEXP_todate');
     $CEXP_radio_button_select_value=$this->input->get('CEXP_radio_button_select_value');
     $header=$this->input->get('header');
     $pdfresult=$this->Mdl_customer_expiry_list->Customer_Expiry_List_pdf($CEXP_fromdate,$CEXP_todate,$CEXP_radio_button_select_value,$UserStamp,$timeZoneFormat);
     $pdfheader='CUSTOMER EXPIRY LIST - '.$header;
     $pdf = $this->pdf->load();
     $pdf=new mPDF('utf-8','A4-L');
     $pdf->SetHTMLHeader('<div style="text-align: center; font-weight: bold;">'.$pdfheader.'</div>', 'O', true);
     $pdf->SetHTMLFooter('<div style="text-align: center;">{PAGENO}</div>');
     $pdf->WriteHTML($pdfresult);
     $pdf->Output($pdfheader.'.pdf', 'D');
 }
 /**
  * Generates the invoice with MPDF lib.
  * @param $dest
  * @return string
  */
 protected function generate($dest, $document)
 {
     set_time_limit(0);
     $mpdf_filename = BEWPI_LIB_DIR . 'mpdf/mpdf.php';
     include $mpdf_filename;
     $mpdf = new mPDF('', 'A4', 0, 'opensans', 17, 17, 150, 50, 20, 0, '');
     $mpdf->useOnlyCoreFonts = false;
     // false is default
     $mpdf->SetTitle($this->title);
     $mpdf->SetAuthor($this->author);
     $mpdf->showWatermarkText = false;
     $mpdf->SetDisplayMode('fullpage');
     $mpdf->useSubstitutions = true;
     $mpdf->SetHTMLHeader($document->header);
     $mpdf->SetHTMLFooter($document->footer);
     $mpdf->WriteHTML($document->css . $document->body);
     $mpdf->Output($document->filename, $dest);
 }