} } else { $html .= '<' . $e . '>'; } } //============================================================== //============================================================== require_once __DIR__ . '/../vendor/autoload.php'; $mpdf = new mPDF('', 'A4', '', '', 32, 25, 27, 25, 16, 13); $mpdf->SetDirectionality('rtl'); $mpdf->mirrorMargins = true; $mpdf->SetDisplayMode('fullpage', 'two'); $mpdf->autoLangToFont = true; $mpdf->defaultPageNumStyle = 'arabic-indic'; $mpdf->setHeader($h); $mpdf->setFooter($f); $mpdf->debug = true; $stylesheet = file_get_contents('mpdfstyletables.css'); $mpdf->WriteHTML($stylesheet, 1); // The parameter 1 tells that this is css/style only and no body/html/text $mpdf->WriteHTML($html); $mpdf->AddPage(); $mpdf->SetColumns(2, 'J'); $mpdf->WriteHTML($html); $mpdf->SetColumns(0); //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // INDEX $html = ' <pagebreak type="next-odd" /> <h2>Index</h2> <columns column-count="2" column-gap="5" />
<?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;
//echo "$query "; /* for ($i = 0; $i < $count; $i++) { echo $html[$i]; } */ //cetak reporting //$mpdf=new mPDF(); $mpdf=new mPDF('','','','',15,15,16,16,9,9,'L'); $mpdf->AddPage('L','','','','',15,15,16,16,9,9); $mpdf->setFooter('{PAGENO} of 1 pages') ; $count = count($html); for ($i = 0; $i < $count; $i++) { if($i==0) $mpdf->WriteHTML($html[$i]); else { $mpdf->AddPage('L','','','','',15,15,16,16,9,9); //$mpdf->AddPage(); $mpdf->WriteHTML($html[$i]); } } $waktu=date("dymhis");
//retrieve html $html=$REPORT->retrieve_html_mutasi_transfer_antar_skpd($result_query, $gambar); //print html $count = count($html); for ($i = 0; $i < $count; $i++) { //echo $html[$i]; } //cetak reporting $REPORT->show_status_download_kib(); $mpdf=new mPDF('','','','',15,15,16,16,9,9,'L'); $mpdf->debug=true; $mpdf->AddPage('L','','','','',15,15,16,16,9,9); $mpdf->setFooter('{PAGENO}') ; $mpdf->progbar_heading = ''; $mpdf->StartProgressBarOutput(2); $mpdf->useGraphs = true; $mpdf->list_number_suffix = ')'; $mpdf->hyphenate = true; $count = count($html); for ($i = 0; $i <= $count; $i++) { if($i==0) $mpdf->WriteHTML($html[$i]); else { $mpdf->AddPage('L','','','','',15,15,16,16,9,9); $mpdf->WriteHTML($html[$i]);
<th>TURNO</th> <th>AREA</th> <th>DEPARTAMENTO</th> <th>MEDICAMENTO(S)</th> <th>FECHA</th><th>PROCESO</th></tr></thead><tbody>' . $tabla . '</tbody></table>'; $html = $tabla; //============================================================== //============================================================== //============================================================== define('_MPDF_URI', 'data/lib/mpdf60/'); include "data/lib/mpdf60/mpdf.php"; $mpdf = new mPDF('utf-8', 'Leter-L', 0, '', 15, 15, 40, 16, 5, 9); $mpdf->SetDisplayMode('fullpage'); $mpdf->SetHTMLHeader(' <table style="width: 100%;"><tr><td><h1>Cirpro de Delicias</h1></td><td style="text-align: right"> <img src="img/header.png" style="height 80pt; width: 110pt; margin 0 0 0 0;" alt="Cardinal Healt"></td></tr></table> <h2>Visitas de ' . $_POST['fecha_inicio_mostrar'] . ' a ' . $_POST['fecha_fin_mostrar'] . ' </h2> <h4>Reporte de Visitas</h4>'); $mpdf->setFooter('Pagina {PAGENO} de {nbpg}'); $mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list // LOAD a stylesheet $stylesheet = file_get_contents('mpdfstyletables.css'); $mpdf->WriteHTML($stylesheet, 1); // The parameter 1 tells that this is css/style only and no body/html/text $mpdf->WriteHTML($html, 2); //print $html; $mpdf->Output('mpdf.pdf', 'I'); exit; //============================================================== //============================================================== //==============================================================
<link rel="stylesheet" type="text/css" href="assets/css/style.css?1453726010" media="all" /> <style type="text/css" media="all"> body { font-family: arial; } </style> </head> <body class="page"> <div id="page" class="print ">'; if ($action != "vp_stitky") { $prt_revision .= '<img src="http://benab.fotovasko.sk/assets/images/logo.jpg" class="logo">'; } $prt_revision .= $print_revision; $prt_revision .= " \r\n </div>\r\n\r\n </body>\r\n </html>\r\n "; if ($action != "vp_stitky") { $mpdf->setFooter('{PAGENO} / {nb}'); } $mpdf->defaultfooterline = 0; $mpdf->debug = true; $mpdf->WriteHTML($prt_revision); $mpdf->Output(); //echo $prt_revision; exit; /* echo $print_revision; echo "<script type=\"text/javascript\">window.print();</script>"; echo "<div class=\"clearer\"></div>"; */ //echo "<h2><a href=\"\">späť na revíziu objednávky</a></h2>"; function print_revision_vyrobny_plan($revision, $sub = "") {
</tr></table> '; $longfooterE = ' <table width="100%" style="border-bottom: 1px solid #000000; vertical-align: bottom; font-family: serif; font-size: 9pt; color: #000088;"><tr> <td width="33%"><span style="font-weight: bold;">Outer footer</span></td> <td width="33%" align="center"><img src="sunset.jpg" width="126px" /></td> <td width="33%" style="text-align: right;">Inner footer p <span style="font-size:14pt;">{PAGENO}</span></td> </tr></table> '; $footer = '<div align="center" style="color:blue;font-family:mono;font-size:18pt;font-weight:bold;font-style:italic;">{DATE j-m-Y} » {PAGENO} » My document</div>'; $footerE = '<div align="center" style="color:green;font-family:mono;font-size:18pt;font-weight:bold;font-style:italic;">Even page footer - {PAGENO} -</div>'; $shortheader = '<div align="center" style="color:blue;font-family:mono;font-size:18pt;font-weight:bold;font-style:italic;">{DATE j-m-Y} » {PAGENO} » My document</div>'; $shortheaderE = '<div align="center" style="color:green;font-family:mono;font-size:18pt;font-weight:bold;font-style:italic;">Even page header - {PAGENO} -</div>'; $mpdf->SetHTMLHeader($header); $mpdf->SetHTMLHeader($headerE, 'E'); $mpdf->setFooter('{PAGENO} of {nbpg} pages||{PAGENO} of {nbpg} pages'); $mpdf->WriteHTML($html); $mpdf->setHeader(); // Clear headers before adding page $mpdf->AddPage('L', '', '', '', '', 25, 25, 55, 45, 18, 12); $mpdf->SetHTMLHeader($shortheader, '', true); // New parameter in v1.4 to add the header to the new page $mpdf->SetHTMLHeader($shortheaderE, 'E', true); $mpdf->SetHTMLFooter($longfooter); $mpdf->SetHTMLFooter($longfooterE, 'E'); $mpdf->WriteHTML($html); $mpdf->WriteHTML($html); $mpdf->WriteHTML($html); $mpdf->setHeader('{PAGENO} of {nbpg} pages||{PAGENO} of {nbpg} pages'); $mpdf->SetHTMLFooter($footer); $mpdf->SetHTMLFooter($footerE, 'E');
function mpdf_output($wp_content = '', $do_pdf = false, $outputToBrowser = true, $pdfName = '', $templatePath = '') { global $post; $pdf_ofilename = $post->post_name . '.pdf'; if (!empty($pdfName)) { $pdf_filename = $pdfName . '.pdf'; } else { $pdf_filename = $pdf_ofilename; } /** * Allow to override the pdf file name */ $pdf_filename = apply_filters('mpdf_output_pdf_filename', $pdf_filename); /** * Geshi Support */ if (get_option('mpdf_geshi') == true) { require_once dirname(__FILE__) . '/geshi.inc.php'; $wp_content = ParseGeshi($wp_content); } /** * Run the content default filter */ $wp_content = apply_filters('the_content', $wp_content); /** * Run the mpdf filter */ $wp_content = mpdf_filter($wp_content, $do_pdf); if ($do_pdf === false) { echo $wp_content; } else { $cacheDirectory = mpdf_getcachedir(); if (!is_dir($cacheDirectory . 'tmp')) { @mkdir($cacheDirectory . 'tmp'); } define('_MPDF_PATH', dirname(__FILE__) . '/mpdf/'); define('_MPDF_TEMP_PATH', $cacheDirectory . 'tmp/'); define('_MPDF_TTFONTDATAPATH', _MPDF_TEMP_PATH); require_once _MPDF_PATH . 'mpdf.php'; global $pdf_margin_left; global $pdf_margin_right; global $pdf_margin_top; global $pdf_margin_bottom; global $pdf_margin_header; global $pdf_margin_footer; global $pdf_html_header; global $pdf_html_footer; if ($pdf_margin_left !== 0 && $pdf_margin_left == '') { $pdf_margin_left = 15; } if ($pdf_margin_right !== 0 && $pdf_margin_right == '') { $pdf_margin_right = 15; } if ($pdf_margin_top !== 0 && $pdf_margin_top == '') { $pdf_margin_top = 16; } if ($pdf_margin_bottom !== 0 && $pdf_margin_bottom == '') { $pdf_margin_bottom = 16; } if ($pdf_margin_header !== 0 && $pdf_margin_header == '') { $pdf_margin_header = 9; } if ($pdf_margin_footer !== 0 && $pdf_margin_footer == '') { $pdf_margin_footer = 9; } if (empty($pdf_html_header)) { $pdf_html_header = false; } if (empty($pdf_html_footer)) { $pdf_html_footer = false; } global $pdf_orientation; if ($pdf_orientation == '') { $pdf_orientation = 'P'; } $cp = 'utf-8'; if (get_option('mpdf_code_page') != '') { $cp = get_option('mpdf_code_page'); } $mpdf = new mPDF($cp, 'A4', '', '', $pdf_margin_left, $pdf_margin_right, $pdf_margin_top, $pdf_margin_bottom, $pdf_margin_header, $pdf_margin_footer, $pdf_orientation); $mpdf->SetUserRights(); $mpdf->title2annots = false; //$mpdf->annotMargin = 12; $mpdf->use_embeddedfonts_1252 = true; // false is default $mpdf->SetBasePath($templatePath); //Set PDF Template if it's set global $pdf_template_pdfpage; global $pdf_template_pdfpage_page; global $pdf_template_pdfdoc; if (isset($pdf_template_pdfdoc) && $pdf_template_pdfdoc != '') { $mpdf->SetImportUse(); $mpdf->SetDocTemplate($templatePath . $pdf_template_pdfdoc, true); } else { if (isset($pdf_template_pdfpage) && $pdf_template_pdfpage != '' && isset($pdf_template_pdfpage_page) && is_numeric($pdf_template_pdfpage_page)) { $mpdf->SetImportUse(); $pagecount = $mpdf->SetSourceFile($templatePath . $pdf_template_pdfpage); if ($pdf_template_pdfpage_page < 1) { $pdf_template_pdfpage_page = 1; } else { if ($pdf_template_pdfpage_page > $pagecount) { $pdf_template_pdfpage_page = $pagecount; } } $tplId = $mpdf->ImportPage($pdf_template_pdfpage_page); $mpdf->UseTemplate($tplId); } } $user_info = get_userdata($post->post_author); $mpdf->SetAuthor($user_info->first_name . ' ' . $user_info->last_name . ' (' . $user_info->user_login . ')'); $mpdf->SetCreator('wp-mpdf'); //The Header and Footer global $pdf_footer; global $pdf_header; $mpdf->startPageNums(); // Required for TOC use after AddPage(), and to use Headers and Footers if ($pdf_html_header) { $mpdf->SetHTMLHeader($pdf_header); } else { $mpdf->setHeader($pdf_header); } if ($pdf_html_footer) { $mpdf->SetHTMLFooter($pdf_footer); } else { $mpdf->setFooter($pdf_footer); } if (get_option('mpdf_theme') != '' && file_exists($templatePath . get_option('mpdf_theme') . '.css')) { //Read the StyleCSS $tmpCSS = file_get_contents($templatePath . get_option('mpdf_theme') . '.css'); $mpdf->WriteHTML($tmpCSS, 1); } //My Filters require_once dirname(__FILE__) . '/myfilters.inc.php'; $wp_content = mpdf_myfilters($wp_content); if (get_option('mpdf_debug') == true) { if (!is_dir(dirname(__FILE__) . '/debug/')) { mkdir(dirname(__FILE__) . '/debug/'); } file_put_contents(dirname(__FILE__) . '/debug/' . get_option('mpdf_theme') . '_' . $pdf_ofilename . '.html', $wp_content); } //die($wp_content); $mpdf->WriteHTML($wp_content); /** * Allow to process the pdf by an 3th party plugin */ do_action('mpdf_output', $mpdf, $pdf_filename); if (get_option('mpdf_caching') == true) { file_put_contents(mpdf_getcachedir() . get_option('mpdf_theme') . '_' . $pdf_ofilename . '.cache', $post->post_modified_gmt); $mpdf->Output(mpdf_getcachedir() . get_option('mpdf_theme') . '_' . $pdf_ofilename, 'F'); if ($outputToBrowser == true) { $mpdf->Output($pdf_filename, 'I'); } } else { if ($outputToBrowser == true) { $mpdf->Output($pdf_filename, 'I'); } } } }
public static function PrintPDF($args) { $html = $args; //$name = $args["name"]; //$css = $args["css"]; include "Lib/PDF/mpdf.php"; $pdf = new mPDF("utf-8"); $pdf->SetHeader("Lapa"); $pdf->setFooter("{PAGENO}"); $pdf->useOnlyCoreFonts = true; $pdf->SetDisplayMode("fullpage"); $pdf->WriteHTML($html); $pdf->Output('page.pdf', 'F'); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Type: application/pdf"); header('Content-Disposition: attachment; filename="http://arthurvershinin.id.lv/page.pdf"'); exit("http://arthurvershinin.id.lv/page.pdf"); }
//$mpdf->StartProgressBarOutput(1); $mpdf->SetDisplayMode('fullpage'); $mpdf->defaultfooterline = 0; $mpdf->SetHTMLHeader(' <table style="width: 100%;"><tr><td><h1>Cirpro de Delicias</h1></td><td style="text-align: right"> <img src="img/header.png" style="height 80pt; width: 110pt; margin 0 0 0 0;" alt="Cardinal Healt"></td></tr></table> <h2>Memos de ' . $_POST['fecha_inicio_mostrar'] . ' a ' . $_POST['fecha_fin_mostrar'] . ' </h2> <h3>AT¨N DEPARTAMENTO DE NOMINAS</h3> <p>Por medio de la presente se le solicita, que a las siguientes personas les sea respetado lo que a continuación se menciona:</p> <p STYLE="text-align:right;">BONOS DE PUNTUALIDAD Y ASISTENCIA</p> '); $mpdf->setFooter(' <table> <tr><td>___________________________________</td><td></td><td>______________________________________________</td><td></td><td>___________________________________</td></tr> <tr><td style="text-align: center; ">Relaciones Laborales</td> <td style="text-align: center;padding-left: 20mm; padding-right: 20mm; "></td> <td style="text-align: center;">GTE. DE REC. HUMANOS</td> <td style="text-align: center;padding-left: 20mm; padding-right: 20mm; "></td> <td style="text-align: center; ">Gte. Finanzas</td></tr> </table> <BR> Pagina {PAGENO} de {nbpg}'); $mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list // LOAD a stylesheet $stylesheet = file_get_contents('mpdfstyletables.css'); $mpdf->WriteHTML($stylesheet, 1); // The parameter 1 tells that this is css/style only and no body/html/text $mpdf->WriteHTML($html, 2); //print $html; $mpdf->Output($NomrePDF, 'I'); exit;
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'); }