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'); }
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 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; }
public function geraPdf($texto) { $pdf = new mPDF(); $pdf->WriteHTML($texto); $pdf->Output(); exit; }
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. }
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 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; }
/** * @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; } }
protected function basicMPdfConfiguration(\mPDF $mPDF) { $mPDF->biDirectional = false; $mPDF->useSubstitutions = false; $mPDF->simpleTables = true; $mPDF->SetAuthor($this->documentAuthor); $mPDF->SetDisplayMode('default', 'continuous'); }
/** * 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'); }
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'); }
public function savePdf($content, $filename) { $previousErrorReporting = error_reporting(0); $pdf = new \mPDF('', $this->format); $pdf->WriteHTML($content); $pdf->Output($filename, 'f'); error_reporting($previousErrorReporting); }
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; }
/** * @param \App\Model\Pdf\IPdfTemplate $pdfTemplate * @param $filename * * @return string */ public function savePdf(IPdfTemplate $pdfTemplate, $filename) { $filename = rtrim($this->documentStorage, "/") . "/" . $filename; $html = (string) $pdfTemplate->render(); $mpdf = new \mPDF(); $mpdf->WriteHTML($html); $mpdf->Output($filename, "F"); return $filename; }
/** * 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(); }
/** * @param array $options Options for mPDF. * @return \mPDF */ protected function createMpdfInstance($options) { $tempDir = sys_get_temp_dir() . '/mpdf'; is_dir($tempDir) or mkdir($tempDir); defined('_MPDF_TEMP_PATH') or define('_MPDF_TEMP_PATH', $tempDir); $mpdf = new \mPDF(isset($options['lang']) ? $options['lang'] : static::DEFAULT_LANGUAGE, isset($options['format']) ? $options['format'] : static::DEFAULT_PAGE_FORMAT, isset($options['fontSize']) ? $options['fontSize'] : static::DEFAULT_FONT_SIZE, isset($options['font']) ? $options['font'] : static::DEFAULT_FONT, isset($options['marginLeft']) ? $options['marginLeft'] : static::DEFAULT_MARGIN, isset($options['marginRight']) ? $options['marginRight'] : static::DEFAULT_MARGIN, isset($options['marginTop']) ? $options['marginTop'] : static::DEFAULT_MARGIN, isset($options['marginBottom']) ? $options['marginBottom'] : static::DEFAULT_MARGIN, isset($options['marginHeader']) ? $options['marginHeader'] : static::DEFAULT_MARGIN, isset($options['marginFooter']) ? $options['marginFooter'] : static::DEFAULT_MARGIN, isset($options['orientation']) ? $options['orientation'] : static::DEFAULT_ORIENTATION); $mpdf->SetDisplayMode('fullpage', 'two'); $mpdf->SetProtection(['copy', 'print', 'print-highres'], null, uniqid(), 128); return $mpdf; }
public function render() { require "../vendor/mpdf/mpdf/mpdf.php"; $mpdf = new \mPDF('', 'A4', 10, 'arial'); $mpdf->mirrorMargins = true; $mpdf->ignore_invalid_utf8 = true; foreach ($this->styleFiles as $file) { $mpdf->WriteHTML(file_get_contents($file), 1); } }
public function render($file = NULL) { // Render the HTML normally $html = parent::render($file); // Render the HTML to a PDF $mpdf = new mPDF('UTF-8', 'A4'); $mpdf->SetAutoFont(AUTOFONT_ALL); $mpdf->WriteHTML($html); return $mpdf->output(); }
function create_pdf($html_data, $file_name = "") { if ($file_name == "") { $file_name = 'report' . date('dMY'); } require 'mpdf/mpdf.php'; $mypdf = new mPDF(); $mypdf->WriteHTML($html_data); $mypdf->Output($file_name . 'pdf', 'D'); }
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; } }
public function cetakbukti($idpendaftaran = 0) { $this->load->library('mpdf60/mpdf'); $data = array(); $data['datamhs'] = $this->db->query("SELECT * FROM view_pendaftaran WHERE id_transaksi_pendaftaran = " . $idpendaftaran)->row(); $template = $this->load->view('viewBuktiBeasiswa', $data, true); $mpdf = new mPDF('c'); $mpdf->WriteHTML($template); $mpdf->Output(); exit; }
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; }
/** * @return string */ public function generate() { if ($this->template === null) { throw new \Exception('Не задан шаблон'); } $mpdf = new \mPDF('utf-8', 'A4'); $mpdf->charset_in = 'utf-8'; $html = $this->twig->render($this->template, array_merge($this->orderDetails, $this->ownDetails)); $mpdf->WriteHTML($html); return $mpdf->Output('', 'S'); }
public function _gen_pdf($html, $paper, $layoutpage) { ob_end_clean(); $mpdf = new mPDF('utf-8', $paper); ini_set('memory_limit', '100M'); $mpdf->debug = true; $mpdf->SetDisplayMode('fullpage'); $mpdf->AddPage($layoutpage); $mpdf->WriteHTML($html); $mpdf->Output(); }
/** * 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); if ($this->_Pdf->orientation() == 'landscape') { $this->_Pdf->pageSize($this->_Pdf->pageSize() . '-L'); } $MPDF = new mPDF(Configure::read('App.encoding'), $this->_Pdf->pageSize()); $MPDF->writeHTML($this->_Pdf->html()); return $MPDF->Output('', 'S'); }
/** * 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); }
/** * 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'); } } }
/** * 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); }