/** * Register the service provider. * * @return void */ public function register() { $this->app->bind('mpdf.wrapper', function ($app, $cfg) { $app['mpdf.pdf'] = $app->share(function ($app) use($cfg) { if (!empty($cfg)) { foreach ($cfg as $key => $value) { Config::set('pdf.' . $key, $value); } } $mpdf = new \mPDF(Config::get('pdf.mode'), Config::get('pdf.defaultFontSize'), Config::get('pdf.defaultFont'), Config::get('pdf.marginLeft'), Config::get('pdf.marginRight'), Config::get('pdf.marginTop'), Config::get('pdf.marginBottom'), Config::get('pdf.marginHeader'), Config::get('pdf.Footer'), Config::get('pdf.orientation')); $permissions = []; foreach (Config::get('pdf.protection.permissions') as $perm => $enable) { if ($enable) { $permissions[] = $perm; } } $mpdf->SetProtection($permissions, Config::get('pdf.protection.user_password'), Config::get('pdf.protection.owner_password'), Config::get('pdf.protection.length')); $mpdf->SetTitle(Config::get('pdf.title')); $mpdf->SetAuthor(Config::get('pdf.author')); $mpdf->SetWatermarkText(Config::get('pdf.watermark')); $mpdf->showWatermarkText = Config::get('pdf.showWatermark'); $mpdf->watermark_font = Config::get('pdf.watermarkFont'); $mpdf->watermarkTextAlpha = Config::get('pdf.watermarkTextAlpha'); $mpdf->SetDisplayMode(Config::get('pdf.displayMode')); return $mpdf; }); return new PdfWrapper($app['mpdf.pdf']); }); }
/** * Register the service provider. * * @return void */ public function register() { $this->app->bind('mpdf.wrapper', function ($app, $cfg) { if ($cfg) { $app['mpdf.pdf'] = $app->share(function ($app) use($cfg) { $mpdf = new \mPDF($cfg[0], $cfg[1], $cfg[2], $cfg[3], $cfg[4], $cfg[5], $cfg[6], $cfg[7], $cfg[8], $cfg[9], $cfg[10]); $mpdf->SetProtection(array('print')); $mpdf->SetTitle(""); $mpdf->SetAuthor(""); $mpdf->SetWatermarkText(""); $mpdf->showWatermarkText = true; $mpdf->watermark_font = 'DejaVuSansCondensed'; $mpdf->watermarkTextAlpha = 0.1; $mpdf->SetDisplayMode('fullpage'); return $mpdf; }); } else { $mpdf = new \mPDF('th', 'A4', '', '', 10, 10, 10, 10, 10, 5); $mpdf->SetProtection(array('print')); $mpdf->SetTitle(""); $mpdf->SetAuthor(""); $mpdf->SetWatermarkText(""); $mpdf->showWatermarkText = true; $mpdf->watermark_font = 'DejaVuSansCondensed'; $mpdf->watermarkTextAlpha = 0.1; $mpdf->SetDisplayMode('fullpage'); $app['mpdf.pdf'] = $mpdf; } return new PdfWrapper($app['mpdf.pdf']); }); // // work --------------------------------------------------------------------------start ---------- // $this->app['mpdf.pdf'] = $this->app->share(function($app) // { // // $cfg =['th','A0','','',10,10,10,10,10,5,'L']; // $cfg = $app['config']['mpdfconfig.pdf.options']; // consolelog('cfg',$cfg); // if($cfg) { // $mpdf = new \mPDF( $cfg[0],$cfg[1],$cfg[2],$cfg[3],$cfg[4],$cfg[5],$cfg[6],$cfg[7],$cfg[8],$cfg[9],$cfg[10] ); // } else { // $mpdf=new \mPDF('th','A4','','',10,10,10,10,10,5); // } // $mpdf->SetProtection(array('print')); // $mpdf->SetTitle("TOMATO POS - Invoice"); // $mpdf->SetAuthor("Thongchai Lim"); // $mpdf->SetWatermarkText("Paid"); // $mpdf->showWatermarkText = true; // $mpdf->watermark_font = 'DejaVuSansCondensed'; // $mpdf->watermarkTextAlpha = 0.1; // $mpdf->SetDisplayMode('fullpage'); // return $mpdf; // }); // $this->app['mpdf.wrapper'] = $this->app->share(function($app) // { // return new PdfWrapper($app['mpdf.pdf']); // }); // // work --------------------------------------------------------------------------end---------- }
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(); } }
<?php $mpdf = new mPDF('', '', 0, '', 10, 10, 16, 16, 9, 26, 'L'); $stylesheet = file_get_contents("../web/css/relatorios-css/relatorio.css"); $mpdf->WriteHTML($stylesheet, 1); $mpdf->SetTitle($model->titulo); // Set a simple Footer including the page number $mpdf->setFooter('<div>Relatório emitido SiGeCentro <br> {PAGENO}/{nb}</div>'); // Turn off (suppress) page numbering from the start of the document $mpdf->AddPage('', '', '', '', 'on'); $header = "<div id='cabecalho' >\n \t\t\t<div id='cabecalho-imagem'>\n \t\t\t\t<img id='cabecalho-img' src='" . $model->getImagemLogo() . "'/>\n \t\t\t</div>\t\n \t\t\t<div id='cabecalho-titulo' >\n \t\t\t\t" . $model->titulo . "\n \t\t\t</div>\n \t\t\t<div id='cabecalho-emissao'>\n <b>SiGeCentro</b> \n <br/>\n \t\t\t\t<b>Emitido em: " . $model->getDataHora() . "</b>\n\n \t\t\t</div>\t\n \t\t</div>\n <div class='clear'> </div>"; $mpdf->SetHTMLHeader($header, null, true); $html = "<div id='corpo'>"; for ($i = 1; $i < 400; $i++) { $html .= "linha número {$i} | " . $i % 40 . "<br>"; if ($i % 40 == 0) { // realiza quebra de página e adiciona uma nova $html .= "</div><pagebreak /><div id='corpo'>"; } } $html .= "</div>"; $mpdf->WriteHTML($html); $mpdf->Output(); exit;
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 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'); }
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 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(); }
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'); }
/** * Register the service provider. * * @return void */ public function register() { // load config $this->mergeConfigFrom(__DIR__ . '/../../config/pdf.php', 'pdf'); // bind wrapper $this->app->bind('mpdf.wrapper', function ($app, $cfg) { $app['mpdf.pdf'] = $app->share(function ($app) use($cfg) { if (!empty($cfg)) { foreach ($cfg as $key => $value) { Config::set('pdf.' . $key, $value); } } $mpdf = new \mPDF(Config::get('pdf.mode'), Config::get('pdf.format'), Config::get('pdf.defaultFontSize'), Config::get('pdf.defaultFont'), Config::get('pdf.marginLeft'), Config::get('pdf.marginRight'), Config::get('pdf.marginTop'), Config::get('pdf.marginBottom'), Config::get('pdf.marginHeader'), Config::get('pdf.marginFooter'), Config::get('pdf.orientation')); $mpdf->SetProtection(array('print')); $mpdf->SetTitle(Config::get('pdf.title')); $mpdf->SetAuthor(Config::get('pdf.author')); $mpdf->SetWatermarkText(Config::get('pdf.watermark')); $mpdf->showWatermarkText = Config::get('pdf.showWatermark'); $mpdf->watermark_font = Config::get('pdf.watermarkFont'); $mpdf->watermarkTextAlpha = Config::get('pdf.watermarkTextAlpha'); $mpdf->SetDisplayMode(Config::get('pdf.displayMode')); return $mpdf; }); return new PdfWrapper($app['mpdf.pdf']); }); }
/** * Register the service provider. * * @return void */ public function register() { $this->mergeConfigFrom(__DIR__ . '/../config/pdf.php', 'pdf'); $this->app->bind('mpdf.wrapper', function ($app, $cfg) { if (Config::has('pdf.custom_font_path') && Config::has('pdf.custom_font_data')) { define(_MPDF_SYSTEM_TTFONTS_CONFIG, __DIR__ . '/../mpdf_ttfonts_config.php'); } $mpdf = new \mPDF(Config::get('pdf.mode'), Config::get('pdf.format'), Config::get('pdf.default_font_size'), Config::get('pdf.default_font'), Config::get('pdf.margin_left'), Config::get('pdf.margin_right'), Config::get('pdf.margin_top'), Config::get('pdf.margin_bottom'), Config::get('pdf.margin_header'), Config::get('pdf.margin_footer'), Config::get('pdf.orientation')); $mpdf->SetTitle(Config::get('pdf.title')); $mpdf->SetAuthor(Config::get('pdf.author')); $mpdf->SetWatermarkText(Config::get('pdf.watermark')); $mpdf->SetDisplayMode(Config::get('pdf.display_mode')); $mpdf->showWatermarkText = Config::get('pdf.show_watermark'); $mpdf->watermark_font = Config::get('pdf.watermark_font'); $mpdf->watermarkTextAlpha = Config::get('pdf.watermark_text_alpha'); return new PdfWrapper($mpdf); }); }
/** * Register the service provider. * * @return void */ public function register() { $this->package('kendu/l4-mpdf'); $this->app['mpdf.pdf'] = $this->app->share(function ($app) { $base = $app['config']->get('l4-mpdf::config.pdf.base'); $options = $app['config']->get('l4-mpdf::config.pdf.options'); $mpdf = new \mPDF(Config::get('pdf.mode'), Config::get('pdf.defaultFontSize'), Config::get('pdf.defaultFont'), Config::get('pdf.marginLeft'), Config::get('pdf.marginRight'), Config::get('pdf.marginTop'), Config::get('pdf.marginBottom'), Config::get('pdf.marginHeader'), Config::get('pdf.Footer'), Config::get('pdf.orientation')); $mpdf->SetProtection(array('print')); $mpdf->SetTitle(Config::get('pdf.title')); $mpdf->SetAuthor(Config::get('pdf.author')); $mpdf->SetWatermarkText(Config::get('pdf.watermark')); $mpdf->showWatermarkText = Config::get('pdf.showWatermark'); $mpdf->watermark_font = Config::get('pdf.watermarkFont'); $mpdf->watermarkTextAlpha = Config::get('pdf.watermarkTextAlpha'); $mpdf->SetDisplayMode(Config::get('pdf.displayMode')); return $mpdf; }); $this->app['mpdf.wrapper'] = $this->app->share(function ($app) { return new PdfWrapper($app['mpdf.pdf']); }); }
/** * Export a pdf * * @static * @param string $title Document title * @param string $css CSS Contents * @param string $html HTML Contents * @param string $page_format Default A4 * @param string $orientation Can be P|L * @return boolean */ public static function pdf_export($title, $css, $html, $page_format = 'A4', $orientation = 'P') { // language set $l = array(); $l['a_meta_charset'] = 'UTF-8'; $l['a_meta_dir'] = 'rtl'; $l['a_meta_language'] = X4Route_core::$lang; $l['w_page'] = _PAGE; X4Core_core::auto_load('mpdf_library'); // create the PDF object $mpdf = new mPDF(X4Route_core::$lang, $page_format, 0, 0, 0, 0, 0, 0, $orientation); $title = SERVICE . ' - ' . $title . ' - ' . date('Y-m-d H:i:s'); $mpdf->SetAuthor($_SESSION['nickname']); $mpdf->SetCreator(SERVICE); $mpdf->SetTitle($title); $mpdf->SetDisplayMode('fullwidth'); $mpdf->WriteHTML($css, 1); $mpdf->WriteHTML($html, 2); $filename = X4Utils_helper::unspace(str_replace(' - ', '-', $title), true); $mpdf->Output($filename . '.pdf', 'D'); exit; }
/** * Register the service provider. * * @return void */ public function register() { $this->package('shinomontaz/l4-mpdf'); if ($this->app['config']->get('l4-mpdf::config.pdf.enabled')) { $this->app['mpdf.pdf'] = $this->app->share(function ($app) { $base = $app['config']->get('l4-mpdf::config.pdf.base'); $options = $app['config']->get('l4-mpdf::config.pdf.options'); $mpdf = new \mPDF('win-1252', 'A4', '', '', 10, 10, 40, 35, 10, 5); $mpdf->SetProtection(array('print')); $mpdf->SetTitle("Acme Trading Co. - Invoice"); $mpdf->SetAuthor("Acme Trading Co."); $mpdf->SetWatermarkText("Paid"); $mpdf->showWatermarkText = false; $mpdf->watermark_font = 'DejaVuSansCondensed'; $mpdf->watermarkTextAlpha = 0.1; $mpdf->SetDisplayMode('fullpage'); return $mpdf; }); $this->app['mpdf.wrapper'] = $this->app->share(function ($app) { return new PdfWrapper($app['mpdf.pdf']); }); } }
<p>Razón social : ' . utf8_encode($t_solicitud->razon_social) . '</p> <div style="text-align: lefth; font-style: italic;"> <img src="../qrcode/image.php?msg=Este es doocumento firmado electrónicamnete y podra ser usado en tiempo de vigencia no mayor a 6&err=M" alt="generation qr-code" style="border: solid 1px black;"> <p style="font-weight: bold; font-size: 7pt;">' . $t_nro . '</p> </div> </body> </html> '; //============================================================== //============================================================== //============================================================== //============================================================== //============================================================== //============================================================== define('_MPDF_PATH', '../'); include "../mpdf.php"; $mpdf = new mPDF('c', 'A4', '', '', 20, 15, 48, 25, 10, 10); $mpdf->SetProtection(array('print')); $mpdf->SetTitle("Solcitud de Producto no Contemplado"); $mpdf->SetAuthor("Servicio Ecuatoriano de Normalizacion INEN"); $mpdf->SetWatermarkText("Documento no oficial"); $mpdf->showWatermarkText = true; $mpdf->watermark_font = 'Christian Miranda '; $mpdf->watermarkTextAlpha = 0.1; $mpdf->SetDisplayMode('fullpage'); $mpdf->WriteHTML($html); $mpdf->Output(); exit; exit;
/** * Create a PDF and export to defined path * @param $dir str directory of the source file to convert * @param $src str filename of the source file to convert * @param $path str path to export the resultant PDF to * @param $chapters array chapters to convert into a single PDF * @param $journalId int Id of the journal(imprint) * @param $args array arguments for the conversion (e.g. Description, cover image, etc) * @param $coverPath str path to export the front cover artwork to */ function createPdf($dir = null, $src, $path, $chapters = array(), $journalId, $args = array(), $coverPath) { $mpdf = new mPDF('utf-8'); $mpdf->useOddEven = 1; $htmlEncode = array('title', 'author'); foreach ($htmlEncode as $encode) { $args[$encode] = htmlentities($args[$encode], ENT_QUOTES, "UTF-8"); } isset($args['title']) ? $mpdf->SetTitle($args['title']) : $mpdf->SetTitle("No Title"); isset($args['description']) ? $mpdf->SetSubject($args['description']) : $mpdf->SetSubject("No description"); isset($args['author']) ? $mpdf->SetCreator($args['author']) : $mpdf->SetCreator("No author"); $CBPPlatformDao =& DAORegistry::getDAO('CBPPlatformDAO'); $imprintType = $CBPPlatformDao->getImprintType($journalId); $stylesheet = $CBPPlatformDao->getImprintStylesheet($journalId); $stylesheetContents = file_get_contents($this->stylesheetDir . "{$stylesheet}.css"); $mpdf->WriteHTML($stylesheetContents, 1); $mpdf->WriteHTML($this->contentStart . ' <htmlpagefooter name="myFooter1" style="display:none"> <table width="100%" style="vertical-align: bottom; font-family: serif; font-size: 8pt; color: #000000; font-weight: bold; font-style: italic;"><tr> <td width="33%" style="text-align: right; ">{PAGENO}</td> </tr></table> </htmlpagefooter> <htmlpagefooter name="myFooter2" style="display:none"> <table width="100%" style="vertical-align: bottom; font-family: serif; font-size: 8pt; color: #000000; font-weight: bold; font-style: italic;"><tr> <td width="33%"><span style="font-weight: bold; font-style: italic;">{PAGENO}</span></td> </tr></table> </htmlpagefooter>'); $imagesize = getimagesize($args['cover']); if (substr($imagesize[1] / $imagesize[0], 0, strpos($imagesize[1] / $imagesize[0], '.') + 1 + 2) == 1.41 || substr($imagesize[1] / $imagesize[0], 0, strpos($imagesize[1] / $imagesize[0], '.') + 1 + 2) == 1.53) { $pdfContent .= '<div style="position: absolute; left:0; right: 0; top: 0; bottom: 0;"><img src="' . $args['cover'] . '" id="cover" /></div>'; } else { $pdfContent .= "<div style='margin: 0 auto; width: 80%; text-align: center;'>"; if (isset($args['title'])) { $pdfContent .= "<h1>" . $args['title'] . "</h1>"; } if (isset($args['cover'])) { $pdfContent .= "<img src=\"" . $args['cover'] . "\" >"; } else { $pdfContent .= "<br/>"; } if (isset($args['author'])) { $pdfContent .= "<h2>" . $args['author'] . "</h2>"; } $pdfContent .= "</div>"; } $mpdf->WriteHTML($pdfContent); $mpdf->AddPage('', '', '', '', 'Off'); $copyrightStatement = $CBPPlatformDao->getJournalCopyrightStatement($journalId); if (!empty($copyrightStatement)) { $copyrightStatement = reset($copyrightStatement); $mpdf->AddPage('', '', '', '', 'Off'); $innerPageConent = "<div style='width: 90%; text-align: center; margin: 0 auto;'><p>" . $copyrightStatement . "</p></div>"; $mpdf->WriteHTML($innerPageConent); } if (!empty($chapters)) { $mpdf->TOCpagebreakByArray(array('TOCusePaging' => true, 'TOCuseLinking' => true, 'toc_preHTML' => '<h1>Table of Contents</h1>', 'toc_postHTML' => '', 'resetpagenum' => 1, 'suppress' => 'true')); $chapterCount = 0; $authorBiographies = 0; foreach ($chapters as $chapter) { if (!isset($chapter['type']) && $chapter['type'] != "supp") { $chapterCount++; } else { if ($chapter['desc'] == "Author Biography") { $authorBiographies++; } $suppChapters = true; } } for ($i = 0; $i < count($chapters); $i++) { $htmlEncode = array('name', 'author'); foreach ($htmlEncode as $encode) { $chapters[$i][$encode] = htmlentities($chapters[$i][$encode], ENT_QUOTES, "UTF-8"); } $document = new TransformDoc(); $document->setStrFile($chapters[$i]['src'], $chapters[$i]['dir']); $document->generateXHTML(); //problem, here $document->validatorXHTML(); if ($chapterCount == 1) { $contentPreg = $this->stripTagsAddChapters($document->getStrXHTML()); $contentPreg = ltrim($contentPreg); if (substr($contentPreg, 0, 13) == "<pagebreak />") { $contentPreg = substr_replace($contentPreg, '', 0, 13); } $mpdf->addPage('', '', '', '', 'On'); $mpdf->PageNumSubstitutions[] = array('from' => $mpdf->page + 1, 'reset' => 1, 'type' => '1', 'suppress' => 'off'); $mpdf->WriteHTML("<div class='content'>", 2); $mpdf->WriteHTML($contentPreg, 2); if ($suppChapters == true) { foreach ($chapters as $chapter) { if (isset($chapter['type']) && $chapter['type'] == "supp") { $document = new TransformDoc(); $document->setStrFile($chapter['src'], $chapter['dir']); $document->generateXHTML(); $document->validatorXHTML(); if ($authorBiographies > 1) { $contentPreg = $this->stripTags($document->getStrXHTML()); $mpdf->TOC_Entry($chapter['name']); $mpdf->WriteHTML("<pagebreak />" . $contentPreg, 2); } else { $addAuthorBiographyToBack = true; $authorBiography = $this->stripTags($document->getStrXHTML()); } } } } break; } else { $contentPreg = $this->stripTags($document->getStrXHTML()); $contentPreg = ltrim($contentPreg); if (substr($contentPreg, 0, 13) == "<pagebreak />") { $contentPreg = substr_replace($contentPreg, '', 0, 13); } if ($i != 0) { $prepend = "<pagebreak />"; } else { $mpdf->addPage('', 'E', '', '', 'On'); $mpdf->PageNumSubstitutions[] = array('from' => $mpdf->page + 1, 'reset' => 1, 'type' => '1', 'suppress' => 'off'); $mpdf->WriteHTML("<div class='content'>", 2); } if ($imprintType == "atomistic") { $mpdf->WriteHTML($prepend . "<tocentry content='" . $chapters[$i]['name'] . "' level='0' />" . $contentPreg, 2); } elseif ($imprintType == "collection") { if ($chapters[$i]['description'] != "") { $introduction = "<div class='submissionIntro'><h1>" . $chapters[$i]['author'] . "</h1>" . $this->stripTags($chapters[$i]['description'], true) . "</div><pagebreak /><tocentry content='" . $chapters[$i]['name'] . " by " . $chapters[$i]['author'] . "' level='0' />"; } $mpdf->WriteHTML($prepend . $introduction . $contentPreg, 2); } } } $mpdf->writeHTML("</div>"); if (isset($args['description'])) { $mpdf->WriteHTML("<pagebreak page-selector='none' odd-footer-value = '' even-footer-value= '' /><pagebreak /><div style='width: 90%; text-align: center; margin: 0 auto;'><p>" . $this->stripTags($args['description'], true) . "</p></div>", 2); if ($addAuthorBiographyToBack == true) { $backCoverContent .= "<div style='width: 90%; text-align: center; margin: 0 auto; margin-top: 10px;'><p>" . $authorBiography . "</p></div>"; } $backCoverContent .= "<p style='width: 90%; text-align: center; margin: 0 auto;'><strong>Published " . date("F Y") . ", Scarborough, UK</strong></p>"; $mpdf->WriteHTML($backCoverContent, 2); } $mpdf->WriteHTML("</body></html>"); $pdfData = $mpdf->Output('', 'S'); $pageCount = $mpdf->page; file_put_contents($path, $pdfData); if (file_exists($this->stylesheetDir . "{$stylesheet}-FC.css")) { $this->createCoverPdf($stylesheet, $pageCount, $args['cover'], $this->stripTags($args['description'], true), $addAuthorBiographyToBack, $authorBiography, $args['title'], $args['imprint'], $coverPath); } return true; } else { $document = new TransformDoc(); $document->setStrFile($src, $dir); $document->generateXHTML(); $document->validatorXHTML(); $contentPreg = $this->stripTagsAddChapters($document->getStrXHTML()); $contentPreg = ltrim($contentPreg); if (substr($contentPreg, 0, 13) == "<pagebreak />") { $contentPreg = substr_replace($contentPreg, '', 0, 13); } $mpdf->addPage('', 'E', '', '', 'On'); $mpdf->PageNumSubstitutions[] = array('from' => $mpdf->page + 1, 'reset' => 1, 'type' => '1', 'suppress' => 'off'); $mpdf->WriteHTML("<div class='content'>", 2); $mpdf->WriteHTML($contentPreg, 2); $mpdf->WriteHTML("</div></body></html>"); $pdfData = $mpdf->Output('', 'S'); file_put_contents($path, $pdfData); return true; } }
</tbody> </table> <div style="text-align: center; font-style: italic;">Payment terms: payment due in 30 days</div> </body> </html> '; //============================================================== //============================================================== //============================================================== //============================================================== //============================================================== //============================================================== define('_MPDF_PATH', '../'); include "../mpdf.php"; $mpdf = new mPDF('c', 'A4', '', '', 20, 15, 48, 25, 10, 10); $mpdf->SetProtection(array('print')); $mpdf->SetTitle("Acme Trading Co. - Invoice"); $mpdf->SetAuthor("Acme Trading Co."); $mpdf->SetWatermarkText("Paid"); $mpdf->showWatermarkText = true; $mpdf->watermark_font = 'DejaVuSansCondensed'; $mpdf->watermarkTextAlpha = 0.1; $mpdf->SetDisplayMode('fullpage'); $mpdf->WriteHTML($html); $mpdf->Output(); exit; 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"); } }
/** * Save PHPExcel to file * * @param string $pFilename Name of the file to save as * @throws PHPExcel_Writer_Exception */ public function save($pFilename = NULL) { $fileHandle = parent::prepareForSave($pFilename); // Default PDF paper size $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) // Check for paper size and page orientation if (is_null($this->getSheetIndex())) { $orientation = $this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P'; $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); $printMargins = $this->_phpExcel->getSheet(0)->getPageMargins(); } else { $orientation = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P'; $printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); $printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins(); } $this->setOrientation($orientation); // Override Page Orientation if (!is_null($this->getOrientation())) { $orientation = $this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT ? PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT : $this->getOrientation(); } $orientation = strtoupper($orientation); // Override Paper Size if (!is_null($this->getPaperSize())) { $printPaperSize = $this->getPaperSize(); } if (isset(self::$_paperSizes[$printPaperSize])) { $paperSize = self::$_paperSizes[$printPaperSize]; } // Create PDF $pdf = new mPDF(); $ortmp = $orientation; $pdf->_setPageSize(strtoupper($paperSize), $ortmp); $pdf->DefOrientation = $orientation; $pdf->AddPage($orientation); // Document info $pdf->SetTitle($this->_phpExcel->getProperties()->getTitle()); $pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator()); $pdf->SetSubject($this->_phpExcel->getProperties()->getSubject()); $pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords()); $pdf->SetCreator($this->_phpExcel->getProperties()->getCreator()); $pdf->WriteHTML($this->generateHTMLHeader(FALSE) . $this->generateSheetData() . $this->generateHTMLFooter()); // Write to file fwrite($fileHandle, $pdf->Output('', 'S')); parent::restoreStateAfterSave($fileHandle); }
public function generate($payment_id) { $this->data['payment_id'] = $payment_id; $payment_info = $this->payment->getPayment($payment_id); if ($payment_info) { if ($this->ion_auth->is_customer() || $this->input->get_post('view') == 'customer') { $user_id = $payment_info->retailer_id; } else { $user_id = $payment_info->depot_id; } $this->data['payment_info'] = $payment_info; $user_info = $this->ion_auth->getSimbanicUser($user_id); $this->data['user_info'] = $user_info; $invoice_month = date("M", strtotime($payment_info->confirm_date)); $pdfFilePath = $invoice_month . '_' . $user_info->full_name . '_' . $user_info->customer_id . '_' . $payment_info->id . ".pdf"; //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 Receipt"); $mpdf->SetAuthor("Walart Pharmaceutical."); $mpdf->SetDisplayMode('fullpage'); $header = $this->load->view(BACKEND . '/payment/generate/header', $this->data, true); $footer = $this->load->view(BACKEND . '/payment/generate/footer', $this->data, true); $html = $this->load->view(BACKEND . '/payment/generate', $this->data, true); $mpdf->SetHTMLHeader($header); $mpdf->SetHTMLFooter($footer); $mpdf->WriteHTML($html); $mpdf->Output($pdfFilePath, "D"); } else { redirect_backend_url('invoice'); } }
public function setTitle($strTitle) { $this->objPdf->SetTitle($strTitle); }
/** * {@inheritdoc} */ public function output() { $extraSettings = $this->config->getExtraSettings(); $pageOrientation = isset($extraSettings['pageOrientation']) ? $extraSettings['pageOrientation'] : self::PAGE_ORIENTATION_PORTRAIT; $pageSize = isset($extraSettings['pageSize']) ? $extraSettings['pageSize'] : self::PAGE_SIZE_A4; $fontSize = isset($extraSettings['fontSize']) ? $extraSettings['fontSize'] : self::FONT_SIZE_DEFAULT; $fontFamily = isset($extraSettings['fontFamily']) ? $extraSettings['fontFamily'] : self::FONT_FAMILY_DEFAULT; $mpdf = new \mPDF('utf-8', $pageSize, $fontSize, $fontFamily, 15, 15, 16, 16, 9, 9, $pageOrientation); $title = $this->config->getTitle(); is_string($title) && $mpdf->SetTitle($title); $mpdf->WriteHTML($this->getRenderedView()); return $this->getBuffer($mpdf); }
public function gerarRelatorio($data = NULL, $origem = NULL) { //verificando a sessao $this->verificarSessao(); //iniciando o relatório $mpdf = new mPDF('', '', 0, '', 15, 15, 35, 16, 9, 9, 'L'); //tamanho do pdf $mpdf->SetDisplayMode('fullpage'); //cabeçalho $mpdf->SetHeader('|Faculdade de Tecnologia Dom Amaury Castanho <br /> Av. Tiradentes, 1211 - Parque Industrial, Itu - SP, 13309-640 <br />(11) 4013-1872|'); //rodapé $mpdf->SetFooter('|Página {PAGENO} de {nb}|www.fatecitu.edu.br'); switch ($origem) { case 1: $html = $this->load->view('relatorio/modelos/historicoAtivo_view', $data, true); //titulo $mpdf->SetTitle('Histórico do Ativo'); //conteúdo $mpdf->WriteHTML($html); //gerar pdf $mpdf->Output('historicoDoAtivo.pdf', 'D'); break; case 2: $html = $this->load->view('relatorio/modelos/ativosPorLocal_view', $data, true); //titulo $mpdf->SetTitle('Ativos por Local'); //conteúdo $mpdf->WriteHTML($html); //gerar pdf $mpdf->Output('ativosPorLocal.pdf', 'D'); break; case 3: //titulo $mpdf->SetTitle('Relatório de Divergência'); $html = $this->load->view('relatorio/modelos/divergencia_view', $data, true); $mpdf->WriteHTML($html); //adicionando uma nova página $mpdf->AddPage(); $html = $this->load->view('relatorio/modelos/ativosLocalErrado_view', $data, true); $mpdf->WriteHTML($html); //adicionando uma nova página $mpdf->AddPage(); $html = $this->load->view('relatorio/modelos/ativoNaoEncontrado_view', $data, true); $mpdf->WriteHTML($html); //gerar pdf $mpdf->Output('assets/docs/' . $data['id'] . '.pdf', 'F'); $mpdf->Output('relatorioDeDivergencia.pdf', 'D'); break; } redirect('ativo/carregarRelatorio'); }
* PURPOSE. See the GNU Affero General Public License for more details. * * * * You should have received a copy of the GNU Affero General Public * * License along with eLabFTW. If not, see <http://www.gnu.org/licenses/>. * * * ********************************************************************************/ require_once 'inc/common.php'; require_once ELAB_ROOT . 'inc/locale.php'; require_once ELAB_ROOT . 'vendor/autoload.php'; // Check id is valid and assign it to $id if (isset($_GET['id']) && is_pos_int($_GET['id'])) { $id = $_GET['id']; } else { die(_("The id parameter is not valid!")); } // check the type if ($_GET['type'] === 'experiments' || $_GET['type'] === 'items') { $type = $_GET['type']; } else { die(_("The type parameter is not valid.")); } // do the pdf $pdf = new \Elabftw\Elabftw\MakePdf($id, $type); $mpdf = new mPDF(); $mpdf->SetAuthor($pdf->author); $mpdf->SetTitle($pdf->title); $mpdf->SetSubject('eLabFTW pdf'); $mpdf->SetKeywords($pdf->tags); $mpdf->SetCreator('www.elabftw.net'); $mpdf->WriteHTML($pdf->content); $mpdf->Output($pdf->getFileName(), 'I');
$res = mysql_query($sql); mysql_query("SET NAMES 'utf8'"); $row = mysql_fetch_array($res); //NUMERO FACTURA $numi = ""; $largura = strlen($row['numero']); for ($xz = $largura; $xz < 5; $xz++) { $numi .= "0"; } $numpresupuesto = "SN-" . $numi . $row['numero'] . "/" . substr($row['fecha'], 0, 4); include "../includes/mpdf60/mpdf.php"; $mpdf = new mPDF('win-1252', 'A4', '', '', 0, 0, 30, 25, 0, 0); $mpdf->useOnlyCoreFonts = true; // false is default $mpdf->SetProtection(array('print')); $mpdf->SetTitle("EMPRESA - Presupuesto"); $mpdf->SetAuthor("EMPRESA"); $mpdf->SetWatermarkText("PRESUPUESTO"); $mpdf->showWatermarkText = true; $mpdf->watermark_font = 'DejaVuSansCondensed'; $mpdf->watermarkTextAlpha = 0.05; $mpdf->SetDisplayMode('fullpage'); /*CABECERA Y ESTILOS*/ $html = "\n<html>\n\t<head>\n\t\t<style>\n\t\t\tbody{\n\t\t\t\t/*font-family: sans-serif;*/\n\t\t\t\tfont-family: DejaVuSansCondensed;\n \t\t\tfont-size: 10pt;\n\t\t\t}\n\t\t\t.cabecera,\n\t\t\t.cliente,\n\t\t\t.contenido,\n\t\t\t.row{\n\t\t\t\tpadding: 0px 20px 0px 20px;\n\t\t\t}\n\t\t\t.cabecera{padding-top: 15px;}\n\t\t\t.cliente{padding:5px 50px;}\n\t\t\t.contenido{padding: 0px 35px;}\n\t\t\t.pie{\n\t\t\t\tbackground: #E5008F;\n\t\t\t\tcolor: #FFFFFF;\n\t\t\t\tfont-size: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\tpadding: 10px; \n\t\t\t}\n\t\t\thr{\n\t\t\t\tcolor: #E5008F;\n\t\t\t\tbackground-color: #E5008F;\n\t\t\t\theight: 1px;\n\t\t\t}\n\t\t\tp{\n\t\t\t\tmargin: 0px;\n\t\t\t}\n\t\t\tspan.icono{font-size: 14px;}\n\t\t\ttd{\n\t\t\t\tvertical-align: top;\n\t\t\t}\n\t\t\t.items td\n\t\t\t{\n \t\t\tborder-left: 0.1mm solid #000000;\n \t\t\tborder-right: 0.1mm solid #000000;\n\t\t\t}\n\t\t\t.items td.zebra{\n\t\t\t\tbackground: #EEE;\n\t\t\t}\n\t\t\t.items td.titulor{\n\t\t\t\tbackground: #E5008F;\n\t\t\t\tcolor: #FFF;\n\t\t\t}\n\t\t\t.items td.blanktotal\n\t\t\t{\n \t\t\tbackground-color: #FFFFFF;\n \t\t\tborder: 0mm none #000000;\n \t\t\tborder-top: 0.1mm solid #000000;\n \t\t\tborder-right: 0.1mm solid #000000;\n\t\t\t}\n\t\t\ttable thead td\n\t\t\t{\n\t\t\t\tbackground-color: #EEE;\n \t\t\ttext-align: center;\n \t\t\tborder: 0.1mm solid #000000;\n\t\t\t}\t\t\t\n\t\t\ttd.totals\n\t\t\t{\n \t\t\ttext-align: right;\n \t\t\tbackground: #EEE;\n \t\t\tborder: 0.1mm solid #000000;\n\t\t\t}\n\t\t\t.lateral {\n\t\t\t\tposition: absolute; \n\t\t\t\toverflow: auto; \n\t\t\t\tleft: 0;\n\t\t\t\tbottom: 20mm; \n\t\t\t\twidth: 250mm; \n\t\t\t\tpadding: 10px 0px 0px 0px; \n\t\t\t\tfont-family:sans; \n\t\t\t\tmargin: 0px;\n\t\t\t\trotate: -90;\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-size: 8px;\n\t\t\t}\n\t\t\t.email{color:#FFF; text-decoration: none;}\n\t\t\t.paginador{text-align: right; font-size: 8px;}\n\t\t</style>\n\t</head>"; //DEFINICION CABECERA Y PIE $html .= ' <body> <!--mpdf <htmlpageheader name="myheader"> <div class="cabecera"> <table width="100%">
function ajax_create_pdf($quotation_id) { $data['quotation'] = $this->quotations_model->get_quotation($quotation_id); $data['qtemplates'] = $this->qtemplates_model->qtemplate_list(); $data['companies'] = $this->customers_model->company_list(); $data['staffs'] = $this->staff_model->staff_list(); $data['pricelists'] = $this->pricelists_model->pricelists_list(); $data['qo_products'] = $this->quotations_model->quot_order_products($quotation_id); $html = $this->load->view('quotations/ajax_create_pdf',$data,true); $filename = 'Quotation-'.$data['quotation']->quotations_number; $pdfFilePath = FCPATH."/pdfs/".$filename.".pdf"; $mpdf=new mPDF('c','A4','','',20,15,48,25,10,10); $mpdf->SetProtection(array('print')); $mpdf->SetTitle("Acme Trading Co. - Invoice"); $mpdf->SetAuthor("Acme Trading Co."); $mpdf->SetWatermarkText($data['quotation']->payment_term); $mpdf->showWatermarkText = true; $mpdf->watermark_font = 'DejaVuSansCondensed'; $mpdf->watermarkTextAlpha = 0.1; $mpdf->SetDisplayMode('fullpage'); $mpdf->WriteHTML($html); $mpdf->Output($pdfFilePath, 'F'); echo base_url()."pdfs/".$filename.".pdf"; exit; }
$sql2 = "select * from main where student_id <=> '{$student_id}'"; //echo $sql2; $result2 = mysqli_query($conn, $sql2); if (!$result2) { die("No result1 " . mysqli_error($conn)); } $row1 = @mysqli_fetch_array($result2); $html = "<html>\n\n<head>\n<style type=\"text/css\">\n.tg {border-collapse:collapse;border-spacing:0;border-color:#ccc;margin:0px auto;}\n.tg td{font-family:Arial, sans-serif;font-size:14px;padding:9px 9px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;}\n.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:9px 9px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#f0f0f0;}\n.tg .tg-30rh{font-style:italic;text-align:center}\n.tg .tg-093g{font-weight:bold;font-style:italic;text-align:center}\n.tg .tg-hgcj{font-weight:bold;text-align:center}\n</style>\n\n\n\n\n</head>\t\n<body>\n<div style=\"text-align:center;\">\n\t<h3> Student Application Form</h3>\n <h4>Anynomus University</h4> \n \n</div>\n<div><h4>Student Infromation</h4>\n<table id=\"one-column-emphasis\"> \n\n\t<tr>\n <td>Name</td>\n <td>{$name_of_student}</td>\n \n <td>Mobile</td>\n <td>{$mob}</td>\n <td> Examination</td>\n <td>{$examination}</td>\n </tr>\n <tr> \n <td>Board</td>\n <td>{$board}</td>\n <td>Roll-No</td>\n <td>{$roll_no}</td>\n <td>Year of Passing</td>\n <td>{$year_of_passing}</td>\n \n </tr>\n</table>\n\n\n\n\n\n\n\n<div><h>Personal Information</h>\n <table id=\"one-column-emphasis\">\n\n\t<tr>\n <td>Fathers Name</td>\n <td>{$row1['f_name']}</td>\n \n <td> Occupation</td>\n <td>{$row1['f_occu']}</td>\n <td> Education</td>\n <td>{$row1['f_edu']}</td>\n <td>Monthely Income</td>\n <td>{$row1['f_income']}</td>\n </tr>\n <tr>\n <td>Mothers Name</td>\n <td>{$row1['m_name']}</td>\n \n <td> Occupation</td>\n <td>{$row1['m_occu']}\n </td>\n \n <td> Education</td>\n <td>{$row1['m_edu']}\n </td>\n\n \n <td>Monthely Income</td> \n <td>{$row1['m_income']}\n\t\t\t </td>\n </tr>\n\n\n\n\n <tr>\n <td>Gender</td>\n <td>{$row1['gender']}</td>\n \n <td>Blood Group</td>\n <td>{$row1['blood_gr']}</td>\n \n <td>Date Of Birth</td>\n <td>{$row1['dob']}</td>\n \n <td>Category</td>\n <td>{$row1['category']}\n </td>\n </tr>\n\n <tr>\n <td>Phycially Handicaped</td>\n <td>{$row1['ph']}\n <td>Religion</td>\n \t <td>{$row1['religion']}\n <td>Minority</td>\n <td>{$row1['minority']} \n </td>\n <td>Nationality</td>\n <td>{$row1['nationality']}</td>\n </tr>\n <tr>\n <td>Sports Quota</td>\n <td>{$row1['sport_quota']}</td>\n \n <td>Extra Caricular</td>\n <td>{$row1['extra_caricular']}</td>\n \n <td>Name of School Lastattend</td>\n <td>{$row1['name_of_last_school']}</td>\n \n <td>BPL</td>\n <td>{$row1['bpl']}</td>\n </tr>\n <tr>\n <td>Games And Sports with Level</td>\n <td>{$row1['game_sport']}</td>\n \n <td>Address</td>\n <td>{$row1['address']}</td> \n \n <td>Local Gurdain</td>\n <td>{$row1['lg']}</td>\n \n <td>Address Of local Gurdian</td>\n <td>{$row1['addr_lg']}</td> \n </tr> \n <tr>\n <td>Nearest Railway Station/Bus stop</td>\n <td>{$row1['rail_bus']}</td>\n \n <td>Scholarship</td>\n <td>{$row1['scholar']}</td>\n \n\n \n <td>Previous Admission</td>\n <td>{$row1['previous_add']}</td>\n </tr>\n\n\n\n</table>\n</div>\t\n\n<div>\n\t<h4>Details of 10+2 </h4>\n</div>\n\n\n<table id=\"one-column-emphasis\">\n <tr>\n <th rowspan=\"2\">Subject</th>\n <th rowspan=\"2\">{$row1['lang1_name']}</th>\n <th rowspan=\"2\">{$row1['lang2_name']}</th>\n <th colspan=\"2\">{$row1['sub1_name']}</th>\n <th colspan=\"2\">{$row1['sub2_name']}</th>\n <th colspan=\"2\">{$row1['sub3_name']}</th>\n <th colspan=\"2\">{$row1['sub4_name']}</th>\n </tr>\n <tr>\n <td>Th</td>\n <td>Pr</td>\n <td>Th</td>\n <td>Pr</td>\n <td>Th</td>\n <td>Pr</td>\n <td>Th</td>\n <td>Pr</td>\n </tr>\n <tr>\n <td>Full<br>Marks</td>\n <td>{$row1['lang1_fm']}</td>\n <td>{$row1['lang2_fm']}</td>\n <td>{$row1['sub1_th_fm']}</td>\n <td>{$row1['sub1_pr_fm']}</td>\n <td>{$row1['sub2_th_fm']}</td>\n <td>{$row1['sub2_pr_fm']}</td>\n <td>{$row1['sub3_th_fm']}</td>\n <td>{$row1['sub3_pr_fm']}</td>\n <td>{$row1['sub4_th_fm']}</td>\n <td>{$row1['sub4_pr_fm']}</td>\n </tr>\n <tr>\n <td>Marks <br>om</td>\n <td>{$row1['lang1_om']}</td>\n <td>{$row1['lang2_om']}</td>\n <td>{$row1['sub1_th_om']}</td>\n <td>{$row1['sub1_pr_om']}</td>\n <td>{$row1['sub2_th_om']}</td>\n <td>{$row1['sub2_pr_om']}</td>\n <td>{$row1['sub3_th_om']}</td>\n <td>{$row1['sub3_pr_om']}</td>\n <td>{$row1['sub4_th_om']}</td>\n <td>{$row1['sub4_pr_om']}</td>\n </tr>\n</table>\n\n\n\n\n<h4> Application Detail</h4> \n<table class=\"tg\" >\n<colgroup>\n<col style=\"width: 222px\">\n<col style=\"width: 216px\">\n<col style=\"width: 219px\">\n</colgroup>\n <tr>\n <th class=\"tg-hgcj\" rowspan=\"2\"><br>Honours</th>\n <th class=\"tg-hgcj\" colspan=\"2\">General</th>\n </tr>\n <tr>\n <td class=\"tg-093g\">Sub1</td>\n <td class=\"tg-093g\">Sub2</td>\n </tr>\n <tr>\n <td class=\"tg-30rh\">{$row1['hons']}</td>\n <td class=\"tg-30rh\">{$row1['sub1']}</td>\n <td class=\"tg-30rh\">{$row1['sub2']}</td>\n </tr>\n</table>\n\n\n\n<div>\n<p>I hearby accknowledge above information are correct...</p>\n \n\n<p>Student Signature Signature</p>\n\n\n</div>\n</body>\n</html>"; //echo $html; include 'mpdf/mpdf.php'; $mpdf = new mPDF(); $mpdf = new mPDF('win-1252', 'A4', '', '', 20, 15, 48, 25, 10, 10); $mpdf->useOnlyCoreFonts = true; // false is default $mpdf->SetProtection(array('print')); $mpdf->SetTitle("Application"); //$mpdf->SetAuthor(".........."); //$mpdf->SetWatermarkText("Submitted"); //$mpdf->showWatermarkText = false; //$mpdf->watermark_font = 'DejaVuSansCondensed'; //$mpdf->watermarkTextAlpha = 0.1; $mpdf->SetDisplayMode('fullpage'); //$mpdf->SetHeader('Referenceno-{DATE jmYmmsshh}{PAGENO}'); //$mpdf->SetFooter('|{PAGENO}|'); $mpdf->WriteHTML($style, 1); //$mpdf->WriteHTML($style2,1); $mpdf->WriteHTML($html); //$mpdf->WriteHTML('hi'); //$mpdf->Output();//For direct out put in browser //$mpdf->Output($filename,'F');//for saving in current directory fource fully for letter use $mpdf->Output($filename, 'D');
<?php ini_set("memory_limit", "256M"); $html = "\n\n<style>\np { text-align: justify; }\ntd { text-align: justify; }\n</style>\n<h1>mPDF</h1>\n<h2>CJK Languages</h2>\n\n\n<bookmark content=\"あめ つち\">\n\n<h4>Japanese (pangrams)</h4>\n<h5>Iroha Uta </h5>\n\n<p style=\"font-family: IPAMinchoP\">いろはにほへと ちりぬるを わかよたれそ つねならむ うゐのおくやま けふこえて あさきゆめみし ゑひもせす </p>\n\n<p lang=\"ja\">色は匂へど 散りぬるを 我が世誰ぞ 常ならむ 有為の奥山 今日越えて 浅き夢見じ 酔ひもせず(ん) </p>\n\n<h5>Tori Naku Uta </h5>\n\n<p style=\"font-family: IPAGothicP\">とりなくこゑす ゆめさませ みよあけわたる ひんかしを そらいろはえて おきつへに ほふねむれゐぬ もやのうち </p>\n\n<p lang=\"ja\">鳥啼く声す 夢覚ませ 見よ明け渡る 東を 空色栄えて 沖つ辺に 帆船群れゐぬ 靄の中 </p>\n\n<h5>Ametsuchi No Uta </h5>\n\n<p style=\"font-family: IPAGothicP\">あめ つち ほし そら / やま かは みね たに / くも きり むろ こけ / ひと いぬ うへ すゑ / ゆわ さる おふ せよ / えのえ*を なれ ゐて </p>\n\n<p lang=\"ja\">天 地 星 空 / 山 川 峰 谷 / 雲 霧 室 苔 / 人 犬 上 末 / 硫黄 猿 生ふ 為よ / 榎の 枝を 馴れ 居て </p>\n\n<h5>Taini no Uta </h5>\n\n<p style=\"font-family: hannoma\">たゐにいて なつむわれをそ きみめすと あさりおひゆく やましろの うちゑへるこら もはほせよ えふねかけぬ </p>\n\n<p lang=\"ja\">田居に出で 菜摘むわれをぞ 君召すと 求食り追ひゆく 山城の 打酔へる子ら 藻葉干せよ え舟繋けぬ </p>\n\n\n<bookmark content=\"美国航空业巨\">\n<h4>Chinese (simplified) GB2312</h4>\n\n<p style=\"font-family: sun-exta\">来自商务部新闻办公室的消息称,中方免除与中国有外交关系的所有非洲重债穷国及最不发达国家截至2005年底对华到期政府无息贷款债务。有关部门已对相关债务进行全面清理核对,对与中国有外交关系的33个非洲重债穷国和最不发达国家,免除其截至2005年底168笔对华到期无息贷款债务。拟于2007年底前与受援国办理完免债协议。</p>\n\n\n<bookmark content=\"「憂鬱小王子」\">\n<h4>Chinese (Traditional - Hong Kong)</h4>\n\n<p lang=\"zh-HK\">「憂鬱小王子」是一個教育網站,它成功結合了香港賽馬會防止自殺研究中心各方面的專才,為青少年人提供精神健康的訊息,對普及抑鬱症知識的貢獻良多。在香港,它曾獲選為「2004年十大健康網站」之一,該項選舉自2005年起改名現時的「優秀網站選舉」。其貢獻在國際間亦備受肯定,2005年,該網站榮獲第八屆「亞洲創新大獎」銀獎。</p>\n\n\n\n<bookmark content=\"키스의\">\n<h4>Korean</h4>\n<p style=\"font-family: unbatang_0613\">키스의 고유조건은 입술끼리 만나야 하고 특별한 기술은 필요치 않다. </p>\n\n</div>\n"; //============================================================== //============================================================== //============================================================== include "../mpdf.php"; $mpdf = new mPDF('-aCJK', 'A4', '', '', 32, 25, 27, 25, 16, 13); $mpdf->SetDisplayMode('fullpage'); $mpdf->SetTitle($utxt['zh-CN']); $mpdf->SetAuthor($utxt['zh-CN']); // LOAD a stylesheet $stylesheet = file_get_contents('mpdfstyleA4.css'); $mpdf->WriteHTML($stylesheet, 1); // The parameter 1 tells that this is css/style only and no body/html/text $mpdf->WriteHTML($html); $mpdf->Output(); exit; //============================================================== //============================================================== //==============================================================
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); } }
/** * 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); }