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');
 }
 /**
  * @param string $dest
  * @param string[] $files
  * @return bool true, falls min ein Quelldokument verwendbar war
  */
 public static function merge($dest, $files)
 {
     Logging::info('Erzeuge ' . $dest);
     //$dest = Files::validateFilename($dest);
     $pdf = new \mPDF('de-DE', 'A4');
     $pdf->SetImportUse();
     $page = 0;
     foreach ($files as $curFile) {
         Logging::info('Eingangsdatei ' . $curFile);
         if ($curFile == '') {
             continue;
         }
         $pagecount = $pdf->SetSourceFile($curFile);
         if ($page != 0) {
             $pdf->AddPage();
         }
         for ($i = 1; $i <= $pagecount; $i++) {
             $import_page = $pdf->ImportPage($i);
             $pdf->UseTemplate($import_page);
             if ($i < $pagecount) {
                 $pdf->AddPage();
             }
         }
         $page++;
     }
     $pdf->Output($dest, 'F');
     return $page > 0;
 }
Example #3
0
 /**
  * @param array $info_warranty
  * @param array $info_car
  * @param array $info_bill
  * @param array $info_ss
  * @param $denpyoNo
  * @param null $savetype
  * @param null $watermark
  * @return bool|string
  * @throws \Exception
  */
 public function exportBill($info_warranty = [], $info_car = [], $info_bill = [], $info_ss = [], $denpyoNo = null, $savetype = null, $watermark = null)
 {
     $data = ['info_warranty' => $info_warranty, 'info_car' => $info_car, 'info_bill' => $info_bill, 'info_ss' => $info_ss];
     $stringTarget = Pdfbill::widget($data);
     $pdf = new \mPDF('ja', 'A4', 0, 'DejaVuSansCondensed', '4', '4', '5', '5', '4', '4');
     $pdf->WriteHTML($stringTarget);
     if ($watermark) {
         $pdf->SetWatermarkImage('../web/img/confidentiality.png', 0.6);
         $pdf->showWatermarkImage = true;
     }
     utilities::createFolder('data/pdf');
     //Create folder data/pdf
     if ($savetype == 'save') {
         if (file_exists('data/pdf/' . $denpyoNo . '.pdf')) {
             return false;
         }
         $pdf->Output('data/pdf/' . $denpyoNo . '.pdf', 'F');
         if (file_exists('data/pdf/' . $denpyoNo . '.pdf')) {
             return true;
         }
     } else {
         utilities::createFolder('data/tmp');
         $name = 'draft-' . md5(uniqid(mt_rand(), true)) . '.pdf';
         $filename = "data/tmp/{$name}";
         $pdf->Output($filename, 'F');
         return $filename;
     }
 }
 /**
  * Saves the pdf to file
  *
  * @param        $strFolder   string The folder as a path without TL_ROOT
  * @param string $strFilename The filename without the path
  *
  * @throws \MpdfException
  */
 public function saveToFile($strFolder, $strFilename = '')
 {
     $strFilename = $strFilename ?: $this->buildFilename();
     // create if not exists
     new \Folder($strFolder);
     $this->objPdf->Output(TL_ROOT . '/' . trim($strFolder, '/') . '/' . $strFilename, 'F');
     // save database entity
     $objFile = new \File(trim($strFolder, '/') . '/' . $strFilename);
     $objFile->close();
 }
Example #5
0
 function create($html = 'KOSONG', $filename = 'pdf', $open = true, $paper = 'A4', $orientation = 'P')
 {
     require_once APPPATH . 'third_party/mpdf/mpdf.php';
     $mpdf = new mPDF('', $paper, '', '', '', '', '', '', '', '', $orientation);
     $mpdf->WriteHTML($html);
     if ($open == true) {
         $mpdf->Output();
     } elseif ($open == false) {
         $mpdf->Output($filename . '.pdf', 'D');
     }
 }
Example #6
0
function pdf_create($html, $filename, $stream = TRUE)
{
    require_once APPPATH . 'helpers/mpdf/mpdf.php';
    $CI =& get_instance();
    $mpdf = new mPDF();
    $mpdf->SetAutoFont();
    $mpdf->WriteHTML($html);
    if ($stream) {
        $mpdf->Output($filename . '.pdf', 'I');
    } else {
        $mpdf->Output('./uploads/temp/' . $filename . '.pdf', 'F');
    }
}
Example #7
0
function pdf_create($html, $filename, $stream = TRUE)
{
    require_once APPPATH . 'helpers/mpdf/mpdf.php';
    $mpdf = new mPDF();
    $mpdf->SetAutoFont();
    $mpdf->WriteHTML($html);
    if ($stream) {
        $mpdf->Output($filename . '.pdf', 'D');
    } else {
        $mpdf->Output('./pdfinvoices/temp/' . $filename . '.pdf', 'F');
        return './pdfinvoices/temp/' . $filename . '.pdf';
    }
}
 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');
 }
Example #9
0
 public function pdfprint($id = null)
 {
     $recibo = $this->Recibos->get($id, ['contain' => ['Clients', 'CuotasPolizas']]);
     $this->response->header(['Content-type: application/pdf;', 'Content-Disposition: inline;']);
     $estilos = file_get_contents(WWW_ROOT . DS . 'htm' . DS . 'recibo01.css');
     $body = file_get_contents(WWW_ROOT . DS . 'htm' . DS . 'recibo01.htm');
     $body = $this->entityToHtml($recibo, $body);
     $pdf = new \mPDF('', array(210, 148));
     //porque mpdf no usa namespaces
     $pdf->SetWatermarkText('ORIGINAL', 0.1);
     $pdf->showWatermarkText = true;
     $pdf->WriteHTML($estilos, 1);
     // 1 significa solo estilos
     $pdf->WriteHTML($body, 2);
     // 2 significa solo html
     $pdf->addPage();
     $pdf->SetWatermarkText('COPIA', 0.1);
     $pdf->showWatermarkText = true;
     $pdf->WriteHTML($body, 2);
     // 2 significa solo html
     $pdf->Output();
     /*
     $this->viewBuilder()->layout('ajax');
     $recibo = $this->Recibos->get($id, [
         'contain' => ['Clients', 'CuotasPolizas']
     ]);
     $this->set('recibo', $recibo);
     $this->set('_serialize', ['recibo']);
     */
 }
Example #10
0
 public function index()
 {
     $final_html = "";
     $css = "<style type='text/css'>\n\t\ttd{\n\t\t\tborder:1px solid black; \n\t\t}\n\t\t.no_border{\n\t\t\tborder: none;\n\t\t} \n\t\t.regionals td{\n\t\t\tmin-width:110px;\n\t\t}\n\t\tth, .title{\n\t\t\tbackground:#DDD;\n\t\t\tborder:none;\n\t\t\tpadding:0;\n\t\t\tmargin:0;\n\t\t}\n\t\t\n\t\t</style>";
     $final_html .= $css;
     $html_title = "<img src='Images/coat_of_arms.png' style='position:absolute;  width:160px; top:0px; right:0px; margin-bottom:-100px;margin-right:-100px;'></img>";
     $html_title .= "<h2 style='text-align:center; text-decoration:underline;'>Republic of Kenya</h2>";
     $html_title .= "<h3 style='text-align:center; text-decoration:underline;'>Ministry of Public Health and Sanitation</h3>";
     $html_title .= "<h1 style='text-align:center; text-decoration:underline;'>MONTHLY VACCINE STOCK MANAGEMENT REPORT</h1>";
     //echo "$html_title";
     $final_html .= $html_title;
     $final_html .= $this->create_national_report();
     $this->load->library('mpdf');
     $mpdf = new mPDF('', 'A4-L', 0, '', 15, 15, 16, 16, 9, 9, '');
     $mpdf->SetTitle('MONTHLY VACCINE STOCK MANAGEMENT REPORT');
     $mpdf->WriteHTML($final_html);
     $regions = Regions::getAllRegions();
     foreach ($regions as $region) {
         $regional_report = $this->create_regional_reports($region);
         $mpdf->AddPage();
         $mpdf->WriteHTML($regional_report);
         //
     }
     //echo $final_html
     $mpdf->Output('Summaries/Monthly_Summary.pdf', 'F');
     $this->email_reports();
 }
 function loadMpdf($html, $output = null, $param = 1)
 {
     // echo "masuk";
     // echo $output;
     // exit;
     global $CONFIG;
     $pdf_ext = '.pdf';
     $mpdfEngine = '../' . LIBS . 'mpdf/mpdf' . $CONFIG[$this->configkey]['php_ext'];
     if (is_file($mpdfEngine)) {
         require_once $mpdfEngine;
         if ($param == 1) {
             $mpdf = new mPDF('c', 'A4', '', '', 15, 15, 16, 16, 9, 9, 'L');
             $mpdf->SetDisplayMode('fullpage');
         } elseif ($param == 2) {
             $mpdf = new mPDF('', '', '', '', 15, 15, 16, 16, 9, 9, 'P');
             $mpdf->AddPage('L', '', '', '', '', 15, 15, 16, 16, 9, 9);
         }
         // $mpdf=new mPDF('c','A4','','',32,25,27,25,16,13);
         // $mpdf->setFooter('{PAGENO}') ;
         $mpdf->WriteHTML($html);
         $mpdf->Output($output . '-' . date(ymdhis) . $pdf_ext, 'D');
         logFile('load excel success');
     } else {
         logFile('excel lib not found');
     }
     exit;
 }
 protected function renderPdf($html, $filename, $options)
 {
     $this->_helper->viewRenderer->setNoRender();
     $margin_left = isset($options['margins']['left']) ? $options['margins']['left'] : 15;
     $margin_right = isset($options['margins']['right']) ? $options['margins']['right'] : 15;
     $margin_top = isset($options['margins']['top']) ? $options['margins']['top'] : 15;
     $margin_bottom = isset($options['margins']['bottom']) ? $options['margins']['bottom'] : 15;
     $margin_header = isset($options['margins']['header']) ? $options['margins']['header'] : 15;
     $margin_footer = isset($options['margins']['footer']) ? $options['margins']['footer'] : 15;
     $format = isset($options['format']) ? $options['format'] : 'A4-L';
     $output_mode = isset($options['output']) ? $options['output'] : 'D';
     define('_MPDF_URI', APPLICATION_PATH . '/../library/MPDF54/');
     define('_MPDF_TEMP_PATH', '/var/www/tm/');
     require_once APPLICATION_PATH . "/../library/MPDF54/mpdf.php";
     /* argumentos:
      * mode: codificacao (basicamente)
      * format: formato da pagina (pode ser adicionado -L depois do formato para forcar modo paisagem
      * tamanho da fonte: e passado 0 para que o tamanho seja setado no arquivo CSS
      * fonte
      * margin_left
      * margin_right
      * margin_top
      * margin_bottom
      * margin_header
      * margin_footer
      */
     $mpdf = new mPDF('utf-8', $format, 0, '', $margin_left, $margin_right, $margin_top, $margin_bottom, $margin_header, $margin_footer);
     $mpdf->ignore_invalid_utf8 = true;
     $mpdf->charset_in = 'utf-8';
     $mpdf->SetDisplayMode('fullpage', 'two');
     $mpdf->WriteHTML($mpdf->purify_utf8($html));
     $mpdf->Output($filename . '.pdf', $output_mode);
     exit;
 }
 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');
 }
Example #14
0
 public function geraPdf($texto)
 {
     $pdf = new mPDF();
     $pdf->WriteHTML($texto);
     $pdf->Output();
     exit;
 }
Example #15
0
function pdf($html, $filename = null)
{
    require_once "mpdf/mpdf.php";
    $mpdf = new mPDF();
    //$mpdf->allow_charset_conversion=true;
    //$mpdf->charset_in='iso-8859-1';
    //Exibir a pagina inteira no browser
    //$mpdf->SetDisplayMode('fullpage');
    //Cabeçalho: Seta a data/hora completa de quando o PDF foi gerado + um texto no lado direito
    //$mpdf->SetHeader('{DATE j/m/Y H:i}|{PAGENO}/{nb}|Texto no cabeçalho');
    //Rodapé: Seta a data/hora completa de quando o PDF foi gerado + um texto no lado direito
    //$mpdf->SetFooter('{DATE j/m/Y H:i}|{PAGENO}/{nb}|Texto no rodapé');
    $mpdf->WriteHTML($html);
    // define um nome para o arquivo PDF
    if ($filename == null) {
        $filename = date("Y-m-d_his") . '_impressao.pdf';
    }
    $path = APPPATH . 'relatorios/';
    var_dump($path);
    if (is_dir($path)) {
        $mpdf->Output($path . $filename, 'F');
        redirect('relatorio_gerado' . $filename);
        //base_url("/assets/js/jquery-1.9.1.js");
    } else {
        echo 'error';
    }
    // $mpdf->Output($filename, 'F');
    //I: send the file inline to the browser. The plug-in is used if available. The name given by filename is used when one selects the "Save as" option on the link generating the PDF.
    //D: send to the browser and force a file download with the name given by filename.
    //F: save to a local file with the name given by filename (may include a path).
    //S: return the document as a string. filename is ignored.
}
 public function pdf($content, $namafile, $paper_size = '', $orientation = 'P', $border = true, $title = '', $subject = '', $mode = 'D', $watermark = false)
 {
     $margin = 20;
     $namafile = preg_replace('/\\.pdf$/', '', $namafile);
     $mL = $mR = $mT = $mB = $margin;
     // $mB = $margin + 50;
     $mH = 0;
     $mF = 0;
     if (!$paper_size) {
         $paper_size = array(215, 330);
     }
     Yii::import('system.docotel.cms.extensions.mpdf.mPDF');
     $mpdf = new mPDF('', $paper_size, 0, '', $mL, $mR, $mT, $mB, $mH, $mF, $orientation);
     $mpdf->SetDefaultFont('Arial');
     $mpdf->SetProtection(array('print', 'print-highres'), '', md5(time()), 128);
     $mpdf->SetTitle($title);
     $mpdf->SetAuthor('Makarim & Taira');
     $mpdf->SetCreator('News');
     $mpdf->SetSubject($subject);
     $mpdf->h2toc = array('H4' => 0, 'H5' => 1);
     //$mpdf->setFooter('{PAGENO}');
     // $stylesheet = file_get_contents(Yii::app()->getBaseUrl(true).'/themes/flatlab/assets/css/bootstrap.min.css'); // external css
     // $mpdf->WriteHTML($stylesheet,1);
     // echo $content; exit;
     $mpdf->WriteHTML($content);
     $mpdf->Output($namafile . '.pdf', $mode);
     if ($mode === 'D' or $mode === 'I') {
         exit;
     }
 }
    function renderForm()
    {
        global $SA_Tables;
        global $SA_DIR;
        require $SA_DIR . "/mpdf60/mpdf.php";
        $currentEventID = get_option('sa-current-event', '');
        $currentEventInfo = $SA_Tables->events->getByID($currentEventID);
        $bidderInfo = $SA_Tables->getBidderInfo($currentEventID, $this->bidderID);
        $auctionItems = $SA_Tables->items->getWinningBidsByBidderNumber($this->bidderNumber);
        $auctionSections = $this->splitItemsIntoSections($auctionItems);
        $tableNumber = floor($bidderInfo['bidderNumber'] / 10.0);
        $ob = sa_template_Summary($currentEventInfo, $bidderInfo, $tableNumber, $auctionSections);
        $pdf = new mPDF();
        $pdf->WriteHTML($ob);
        $docStr = $pdf->Output("doc.pdf", "S");
        ?>
		<div style="width:100%;height:600px;">
		<embed width=100% height=100%type="application/pdf" src="data:application/pdf;base64,<?php 
        echo base64_encode($docStr);
        ?>
"></embed>
		</div>
		<?php 
        // echo $ob;
    }
 function loadMpdf($html, $output = null, $path = null)
 {
     // echo "masuk";
     // echo $output;
     // exit;
     global $CONFIG;
     $hslpath = $path . "hasil/";
     $pdf_ext = '.pdf';
     $mpdfEngine = LIBS . 'mpdf/mpdf' . $CONFIG[$this->configkey]['php_ext'];
     if (is_file($mpdfEngine)) {
         require_once $mpdfEngine;
         $mpdf = new mPDF('c', 'A4', '', '', 32, 25, 27, 25, 16, 13);
         $mpdf->SetDisplayMode('fullpage');
         /*$mpdf=new mPDF('','','','',15,15,16,16,9,9,'P');
           $mpdf->AddPage('L','','','','',15,15,16,16,9,9);
           $mpdf->setFooter('{PAGENO}') ;*/
         $stylesheet = file_get_contents($CONFIG['default']['root_path'] . 'assets/css/mpdfstyleA4.css');
         $mpdf->WriteHTML($stylesheet, 1);
         $mpdf->WriteHTML($html);
         $mpdf->Output($hslpath . $output . $pdf_ext, 'F');
         logFile('load excel success');
         return true;
     } else {
         logFile('excel lib not found');
     }
     exit;
 }
 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 #20
0
 public function create_pdf($name, $size, $html)
 {
     ob_end_clean();
     $mpdf = new mPDF('utf-8', $size);
     $mpdf->WriteHTML(utf8_encode($html));
     $mpdf->Output($name . ".pdf", 'I');
     exit;
 }
Example #21
0
 protected static function MPDF($html, $fileout)
 {
     self::loadLib('/mpdf/mpdf.php');
     $html2pdf = new mPDF('c', 'A4');
     //('P', 'A4', 'en');
     $html2pdf->WriteHTML($html);
     $html2pdf->Output($fileout, 'F');
 }
Example #22
0
 /**
  * Generates Pdf from html
  *
  * @return string raw pdf data
  */
 public function output()
 {
     //mPDF often produces a whole bunch of errors, although there is a pdf created when debug = 0
     //Configure::write('debug', 0);
     $MPDF = new \mPDF();
     $MPDF->writeHTML($this->_Pdf->html());
     return $MPDF->Output('', 'S');
 }
Example #23
0
 public function savePdf($content, $filename)
 {
     $previousErrorReporting = error_reporting(0);
     $pdf = new \mPDF('', $this->format);
     $pdf->WriteHTML($content);
     $pdf->Output($filename, 'f');
     error_reporting($previousErrorReporting);
 }
Example #24
0
 /**
  * Generates Pdf from html
  *
  * @return string raw pdf data
  */
 public function output()
 {
     //mPDF often produces a whole bunch of errors, although there is a pdf created when debug = 0
     //Configure::write('debug', 0);
     $orientation = $this->_Pdf->orientation() == 'landscape' ? 'L' : 'P';
     $MPDF = new \mPDF($this->_Pdf->encoding(), $this->_Pdf->pageSize() . '-' . $orientation);
     $MPDF->writeHTML($this->_Pdf->html());
     return $MPDF->Output('', 'S');
 }
 function _pdf_it($html, $page_orientation = 'A4-L')
 {
     $this->load->library('m_pdf');
     $pdf = new mPDF('utf-8', $page_orientation);
     //generate the PDF from the given html
     $pdf->WriteHTML($html);
     //download it.
     $pdf->Output();
 }
 /**
  * PDF of a test order is downloaded by this method
  */
 public function downloadpdfAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $id = $this->getRequest()->getParam('id', '');
     $email = $this->getRequest()->getParam('email', 0);
     require_once 'mpdf/mpdf.php';
     $html .= $this->view->action('viewreport', 'patient', 'patient', array('id' => $id));
     $mpdf = new mPDF('+aCJK', 'A4', '', '', 15, 15, 15, 0, 0, 0);
     $mpdf->mirrorMargins = 0;
     $mpdf->setAutoBottomMargin = 'stretch';
     $mpdf->SetDisplayMode('fullwidth');
     $mpdf->WriteHTML($html);
     $fileName = 'PDF_Form' . time() . '.pdf';
     $mpdf->Output('tmp/' . $fileName, $email ? 'F' : 'D');
     if ($email) {
         $patient = patient::getOrderById($id);
         $mail = new PHPMailer();
         $mail->From = '*****@*****.**';
         $mail->FromName = 'Lab';
         $mail->addAddress($patient[0]['email'], '');
         $mail->addAttachment('tmp/' . $fileName);
         $mail->Subject = 'Your Test Report';
         $mail->Body = 'Please find attached report';
         if (!$mail->send()) {
             echo 'Message could not be sent.';
             echo 'Mailer Error: ' . $mail->ErrorInfo;
         } else {
             unlink('tmp/' . $fileName);
             $flashMessenger = $this->_helper->getHelper('FlashMessenger');
             $flashMessenger->addMessage('mail_sent');
             $this->_redirect('/patient/orders');
         }
     }
 }
 public static function gerar()
 {
     $template = $_GET['template'];
     $css = is_file('util/rel_templates/' . $template . ".css") ? 'util/rel_templates/' . $template . ".css" : 'util/rel_templates/mpdfstyletables.css';
     if (!isset($_GET['dados'])) {
         $classe = $_GET['classe'];
         $metodo = $_GET['metodo'];
         $parametros = $_GET['parametros'];
         $dados = call_user_func_array(array(new $classe(), $metodo), $parametros);
     } else {
         $dados = $_GET['dados'];
     }
     $html = self::getHtmlTemplate("util/rel_templates/" . $template . ".php", $dados);
     $mpdf = new mpdf();
     $papel = isset($_GET['papel']) ? $_GET['papel'] : 'A4';
     $mpdf = new mPDF('c', $papel, '', '', 5, 5, 15, 5, 5, 5);
     //$mpdf->use_kwt = true ;
     //$mpdf->list_indent_first_level = 0;
     $stylesheet = file_get_contents($css);
     $mpdf->WriteHTML($stylesheet, 1);
     $mpdf->WriteHTML($hhtml, 2);
     $mpdf->setFooter('{PAGENO} of {nbpg} pages||{PAGENO} of {nbpg} pages');
     $mpdf->WriteHTML($html, 2);
     $mpdf->Output("relatorio.pdf", 'I');
 }
Example #28
-1
 /**
  * Converte e exibe um text/html em formato PDF.
  *
  * @access public
  * @param string $html - O html a ser exibido.
  * @return void
  */
 public function generate($html)
 {
     require_once BASEPATH . "libraries/mpdf60/mpdf.php";
     $mpdf = new mPDF('en-X', 'A4', '', '', 11, 11, 10, 10, 5, 5, 'P');
     $mpdf->WriteHTML($html);
     $mpdf->Output();
 }
    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);



    }
Example #30
-2
 /**
  * Tworzenie pdf na podstawie html
  *
  * @param type $rendered
  * @param type $dest typ wyjścia zgdny z biblioteka MPDF
  * @param type $name nazwa/ sciezka do pliku (jesli $dest jest F) 
  */
 public static function renderPdf($rendered, $dest = 'D', $name = 'reklamacja.pdf')
 {
     require_once APPLICATION_PATH . '/../library/Mpdf/mpdf.php';
     $mpdf = new mPDF('utf-8', 'A4', '', '', '15', '15', '16', '30', '9', '20');
     $mpdf->WriteHTML($rendered);
     $mpdf->Output($name, $dest);
 }