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'); }
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']); */ }
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, $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; }
/** * Erzeugt ein PDF auf Basis der übergebenen Funktion. * @param $module * @param $action * @param $param * @param null $filename falls kein Dateiname angegeben wird, wird das PDF direkt im Browser ausgegeben * @throws \Exception */ public static function generate($module, $action, $param, $filename = null, $template = true, $margin = 0) { $druckinhalt = new WrapperControl(null, 'druck'); $druckinhalt->setModule($module)->setAction($action)->addParams($param); $pdf = new \mPDF('de-DE', 'A4'); $pdf->SetDisplayMode('fullpage'); // Zeigt eine ganze Seite an, wenn das PDF in Acrobat geöffnet wird if ($margin > 0) { $pdf->SetTopMargin($margin); } $pdf->SetFooter('Seite {PAGENO} / {nb}'); //file_get_contents('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css') . $stylesheet = file_get_contents('templates/print/css/default.css'); $pdf->WriteHTML($stylesheet, 1); if ($template && file_exists('site/Print.template.html')) { $vars = ['heading' => Application::getCurrentResponse()->getMetadata()->getHeading()]; $header = Parser::parse(null, null, $vars, file_get_contents('site/Print.template.html')); $pdf->WriteHTML($header, 2); } $pdf->WriteHTML($druckinhalt->toHtml(), 2); if ($filename === null) { $pdf->Output($module . $action . '.pdf', 'I'); } else { //$filename = Files::validateFilename($filename); $pdf->Output($filename, 'F'); } unset($pdf); }
public function createPDF($id) { //$css = file_get_contents('public/css/bootstrap.min.css'); $css = file_get_contents('public/css/estilo.css'); $matrizEdit = DB::table('matriz_sem')->where('id_matriz', '=', $id)->get(); $matrizMat = DB::table('matriz_mat')->where('id', '=', $id)->get(); $professor = Professor::lists('nome_pro', 'id'); $disciplinaConteudo = Disciplina::leftJoin('componente_curricular_ccr', 'componente_curricular_ccr.id', '=', 'disciplina_dis.id_ccr_dis')->leftJoin('matriz_mat', 'matriz_mat.id', '=', 'disciplina_dis.id_mat_dis')->leftJoin('categoria_disciplina_ctd', 'categoria_disciplina_ctd.id', '=', 'disciplina_dis.id_ctd_dis')->select('nome_ccr')->get(); $pdf = "<table class='table table-striped' border='1' cellpadding='0' cellspacing='0' align='center'>\n\t\t\t\t\t<tr class='header'>\n\t\t\t\t\t\t<th>SEM</th>\n\t\t\t\t\t\t<th>TURMA</th>\n\t\t\t\t\t\t<th>CÓDIGO</th>\n\t\t\t\t\t\t<th>DISCIPLINA</th>\n\t\t\t\t\t\t<th>HA</th>\n\t\t\t\t\t\t<th>CR</th>\n\t\t\t\t\t\t<th>HOR</th>\n\t\t\t\t\t\t<th>BL</th>\n\t\t\t\t\t\t<th>SALA</th>\n\t\t\t\t\t\t<th>PROF</th>\n\t\t\t\t\t</tr>"; $count = 0; $color = false; foreach ($matrizEdit as $materia) { if (!$materia->ofertar) { $pdf .= $color ? "<tr>" : "<tr class=\"zebra\">"; $pdf .= "<td align='center'>{$materia->semestre}</td>"; $pdf .= "<td align='center'>{$materia->id_turma}</td>"; $pdf .= "<td>{$materia->codigo_dis}</td>"; $nome_dis = $disciplinaConteudo[$count]->nome_ccr; $pdf .= "<td>{$nome_dis}</td>"; if ($materia->id_ccr_dis == 31 || $materia->id_ccr_dis == 38 || $materia->id_ccr_dis == 44) { $pdf .= "<td align='center'>34</td>"; $pdf .= "<td align='center'>2</td>"; } else { $pdf .= "<td align='center'>68</td>"; $pdf .= "<td align='center'>4</td>"; } $pdf .= "<td align='center'>{$materia->semana}{$materia->turno}</td>"; $pdf .= "<td align='center'>{$materia->predio}</td>"; $pdf .= "<td>{$materia->sala}</td>"; if (isset($professor[$materia->professor])) { $id_professor = $materia->professor; $pdf .= "<td>{$professor[$id_professor]}</td>"; } else { $pdf .= "<td></td>"; } $pdf .= "</tr>"; $color = !$color; } $count++; } $pdf .= "</table>"; if (isset($matrizMat)) { $file = $matrizMat[0]->nome_mat . ".pdf"; $file = str_replace('/', '-', $file); } else { $file = "Matriz.pdf"; } $mpdf = new mPDF('utf-8', 'A4'); $mpdf->WriteHTML($css, 1); $mpdf->WriteHTML($pdf); $mpdf->Output($file, 'I'); }
public function actionPdf() { $mpdf = new \mPDF("lo"); //mPDF($mode='',$format='A4',$default_font_size=0,$default_font='',$mgl=15,$mgr=15,$mgt=16,$mgb=16,$mgh=9,$mgf=9, $orientation='P') $mpdf->WriteHTML("<style>" . file_get_contents("bootstrap/css/bootstrap.css") . "</style>"); $mpdf->WriteHTML("<style>" . file_get_contents("css/site.css") . "</style>"); // $mpdf->FontFamily = 'Saysettha OT'; // $mpdf->fontlist="Saysettha OT"; // $mpdf->fonts = "Phetsarath_OT.ttf"; $mpdf->WriteHTML($this->renderPartial('index')); $mpdf->Output('MyPDF.pdf', 'I'); exit; }
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ó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 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; }
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; }
public function ActionCreatePDF($id) { $mpdf = Yii::app()->ePdf->mpdf(); $model_historia = $this->loadModel($id); $model_historiaO_paciente = HistoriaObstetricia::model()->getHistoriasObstetriciaByPaciente($model_historia->paciente->id); $model_historiaG_paciente = HistoriaGinecologia::model()->getHistoriasGinecologicasByPaciente($model_historia->paciente->id); $historia = array($model_historiaG_paciente, $model_historiaO_paciente); $stylesheet = file_get_contents('C:\\wamp\\www\\Gineobs\\themes\\hebo\\css\\pdfMain.css'); //configurando pdf general $mpdf = new mPDF('utf-8', 'Letter-L'); //agregando header y footer $mpdf->SetHeader('{DATE j-m-Y}||Recipe #' . $model_historia->paciente->id); $mpdf->SetFooter('Dr. María Hernández|Ginecologia y obstetricia|{PAGENO}'); //Propiedades del PDF $mpdf->setTitle("Historia Medica"); $mpdf->setAuthor("María Hernández"); $mpdf->setCreator("Edgar Cardona y Gabriela Soto"); $mpdf->setSubject("Historia medica de pacientes."); $mpdf->setKeywords("Historia,Medicina"); //escribiendo CSS $mpdf->WriteHTML($stylesheet, 1); //Escribiendo PDF $mpdf->writeHTML($this->renderPartial('historia', array('model' => $model_historia->paciente->id, 'historia' => $historia), true), 2); //Salida $mpdf->output("Recipe Medico", EYiiPdf::OUTPUT_TO_DOWNLOAD); }
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'); }
/** * @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; } }
public function geraPdf($texto) { $pdf = new mPDF(); $pdf->WriteHTML($texto); $pdf->Output(); 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; }
/** * 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); }
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 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. }
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ón', 'Nombres', 'Apellidos', 'Correo', 'Dirección', 'Telé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'); }
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; }
public function savePdf($content, $filename) { $previousErrorReporting = error_reporting(0); $pdf = new \mPDF('', $this->format); $pdf->WriteHTML($content); $pdf->Output($filename, 'f'); error_reporting($previousErrorReporting); }
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'); }
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'); }
/** * @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; }
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(); }
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'); }
/** * 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(); }
/** * 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 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); }
/** * 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); }