/** * 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---------- }
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; } }
/** * 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']); }); }
protected function basicMPdfConfiguration(\mPDF $mPDF) { $mPDF->biDirectional = false; $mPDF->useSubstitutions = false; $mPDF->simpleTables = true; $mPDF->SetAuthor($this->documentAuthor); $mPDF->SetDisplayMode('default', 'continuous'); }
/** * 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); }); }
static public function mpdf( $html_path, $pdf_path, $css_rel_path, $format = 'A4', $download = false) { // reporting komplett abschalten $error_reporting = error_reporting(); error_reporting(0); ProjectConfiguration::registerMPDF(); $mpdf=new mPDF('ch-DE',$format,'8','DejaVuSansCondensed',15,15,30,15,10,10); $mpdf->packTableData = true; //$mpdf->debug = true; $mpdf->SetDisplayMode('fullpage'); $mpdf->defaultfooterfontstyle=''; $mpdf->defaultfooterfontsize='8'; $mpdf->SetFooter(basename($pdf_path).'|Stand: {DATE j.m.Y H:i}|Seite {PAGENO}/{nbpg}'); $mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list $mpdf->shrink_tables_to_fit=1; // LOAD a stylesheet #$stylesheet = file_get_contents(sfConfig::get('sf_web_dir').'/css/backend/pdf/class_etat.css'); $stylesheet = file_get_contents(sfConfig::get('sf_web_dir').'/css/'.$css_rel_path); $mpdf->WriteHTML($stylesheet,1); // parameter 1 indicates this is css $html = file_get_contents($html_path); $mpdf->WriteHTML($html,2); //$mpdf->SetTitle(); $mpdf->SetAuthor(''); $mpdf->SetCreator('rockstep'); if ($download) { $mpdf->Output( $pdf_path, 'I'); } else { $mpdf->Output( $pdf_path, 'F'); } error_reporting($error_reporting); }
/** * 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']); }); } }
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"); } }
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%"> <tr>
<?php # THIS ONE DOES NOT HAVE AddPageByArray ANY MORE :-) include "../mpdf.php"; $html_data = file_get_contents("body.html"); $html = substr($html_data, 12, strlen($html_data) - 27); $style_data = file_get_contents("style_setheader.css"); $frontmatter_data = file_get_contents("frontmatter_setheader.html"); // Create new PDF with font subsetting, 234mm wide, 297mm high $mpdf = new mPDF('s', array(234, 297)); // Make it DOUBLE SIDED document with 4mm bleed $mpdf->mirrorMargins = 1; $mpdf->bleedMargin = 4; $mpdf->h2toc = array(); $mpdf->WriteHTML($style_data, 1); $mpdf->WriteHTML($frontmatter_data, 2); $mpdf->WriteHTML($html, 2); $mpdf->SetTitle("An Example Title"); $mpdf->SetAuthor("Aco"); $mpdf->SetCreator("Booktype 2.0 and mPDF 6.0"); $mpdf->Output(); ?>
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'); } }
/** * function is used for Purchase Receipts * @author Rohan Julka */ public function renderPDF($transactionID = NULL) { $logoUrl = $this->webroot . 'img/logo_black.png'; $paidLogo = $this->webroot . 'img/canstock12610992.jpg'; if ($transactionID) { $txData = $this->Transaction->find('first', array('conditions' => array('Transaction.id' => $this->Encryption->decode($transactionID)))); $amountPaid = $txData['Transaction']['amount_paid']; $discounts = 49.99 - $amountPaid; $discounts = number_format((double) $discounts, 2, '.', ''); if (!empty($txData)) { $html = ' <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title>FoxHopr</title> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> </head> <body id="page-top" class="index"> <style> .table-responsive { min-height: 0.01%; overflow-x: auto; } table.table > tbody > tr > td, .table > tbody > tr > th, table.table > tfoot > tr > td, table.table > tfoot > tr > th, table.table > thead > tr > td, table.table > thead > tr > th { border: 0.1mm solid #ddd; line-height: 1.42857; padding: 8px; vertical-align: top; text-align:left;font-family: "Times New Roman", Times, serif; fo } .items tbody,.items thead { border-top: 0.1mm solid #000000;} td { vertical-align: top; } .items td { border-top: 0.1mm solid #ddd; } table thead td { text-align: center; font-variant: small-caps; } .items td.totals { text-align: right; border: 0.1mm solid #000000; } .items td.cost { text-align: "." center; } </style> <htmlpageheader name="myheader"> </htmlpageheader> <htmlpagefooter name="myfooter"> <div style="border-top: 1px solid #000000; font-size: 9pt; text-align: center; padding-top: 3mm; "> Page {PAGENO} of {nb} </div> </htmlpagefooter> <sethtmlpageheader name="myheader" value="on" show-this-page="1" /> <sethtmlpagefooter name="myfooter" value="on" /> mpdf--> <table class="table items"> <tr> <th scope="row" style="border-top:0"><a href="' . Router::url('/') . '"><img src="' . $logoUrl . '" style="float:left;display:inline-block;text-align:left;width:30%;"></a></th> </tr> </table> <table class="table table-bordered items" width="100%" style="width:700px; margin:0 auto;font-size: 13pt; border-collapse: collapse; "> <thead> <tr> <th style=" border-top:0"></th> <td style=" border-top:0"></td> <th style=" text-align:right; border-top:0;padding-bottom:10px;padding-right:5px;">Receipt</th> </tr> </thead> <tbody> <tr > <td style="padding-top:30px;padding-left:5px;"><strong>Billed to:</strong></td> <td style="padding-top:30px;"></td> <td style="text-align:right;padding-top:30px;line-height:25px;padding-right:5px;"><strong>Receipt Date:</strong> ' . date('M d, Y', strtotime($txData['Transaction']['created'])) . '<br> </td> </tr> <tr style="border:none;"> <td style="padding-top:2px;"></td> <td style="padding-top:2px;"></td> <td style="padding-top:2px;"></td> </tr> <tr style="border:none;"> <td class="bt" style="padding-left:5px;">' . $txData['BusinessOwner']['email'] . '<br> ' . $txData['BusinessOwner']['fname'] . ' ' . $txData['BusinessOwner']['lname'] . '<br>'; if (!empty($txData['BusinessOwner']['address'])) { $html .= ucfirst($txData['BusinessOwner']['address']); } if ($txData['BusinessOwner']['address'] != '' && $txData['BusinessOwner']['city'] != '') { $html .= ', '; } if (!empty($txData['BusinessOwner']['city'])) { $html .= ucfirst($txData['BusinessOwner']['city']); } $html .= ' </td> <td class="bt"></td> <td class="bt"></td> </tr> <tr style="border:none;border-bottom:1px solid #ddd;"> <td class="bt" style="padding-bottom:10px;padding-left:5px;">' . $txData['State']['state_subdivision_name'] . ' ' . $txData['BusinessOwner']['zipcode'] . '<br> ' . $txData['Country']['country_name'] . ' </td> <td class="bt"></td> <td class="bt"></td> </tr> <tr> <th style="text-align:left;padding-bottom:20px;padding-left:5px;width:40%;">Membership Plan</th> <th style="text-align:left;padding-bottom:20px;width:20%;">Discount</th> <th style="text-align:right;padding-bottom:20px;width:40%;padding-right:5px;">Price</th> </tr> <tr> <td style="padding-bottom:40px;padding-left:5px;padding-left:5px;padding-right:5px;">' . ucfirst($txData['Transaction']['group_type']) . '</td> <td style="padding-bottom:40px;padding-right:5px;">$' . $discounts . '</td> <td style="text-align:right;padding-bottom:40px;padding-right:5px;">$49.99</td> </tr> <tr> <td></td> <td></td> <td style="text-align:right;line-height:25px;"><b>Total: $' . $amountPaid . '</b> </td> </tr> </tbody> </table> </body> </html>'; $mpdf = new mPDF('c', 'A4', '', '', 15, 15, 30, 25, 10, 10); $mpdf->SetProtection(array('print')); $mpdf->SetTitle("FOXHOPR - Invoice"); $mpdf->SetAuthor("FOXHOPR"); $mpdf->SetDisplayMode('fullpage'); /*$mpdf->SetWatermarkText('PAID'); $mpdf->watermark_font = 'DejaVuSansCondensed';*/ $mpdf->showWatermarkImage = true; $mpdf->SetWatermarkImage('http://10.10.12.69/foxhopr_testing/img/watermark.jpg', 0.15, 'F'); //$mpdf->showWatermarkText = true; $mpdf->WriteHTML($html); $mpdf->Output(); exit; } else { $this->Session->setFlash('Invalid Transaction ID', 'Front/flash_bad'); $this->redirect(array('action' => 'purchaseReceipts')); } } else { $this->Session->setFlash('Invalid Transaction ID', 'Front/flash_bad'); $this->redirect(array('action' => 'purchaseReceipts')); } }
include "../mpdf-6.1.2/mpdf.php"; $html_data = file_get_contents("body-ar.html"); $style_data = file_get_contents("style-ar.css"); // Create new PDF with font subsetting, 210mm wide, 297mm high $mpdf = new mPDF('s', array(210, 297)); // Make it a double sided document with 4mm bleed $mpdf->mirrorMargins = 1; $mpdf->bleedMargin = 4; // Set right to left text $mpdf->SetDirectionality('rtl'); // Generate the table of contents from H3 elements $mpdf->h2toc = array('H3' => 0); // Write the stylesheet $mpdf->WriteHTML($style_data, 1); // The parameter 1 tells mPDF that this is CSS and not HTML // Write the main text $mpdf->WriteHTML($html_data, 2); // Set the metadata $mpdf->SetTitle("An Example Title"); $mpdf->SetAuthor("Cicero"); $mpdf->SetCreator("mPDF 6.1.2"); $mpdf->SetSubject("Lorem Ipsum"); $mpdf->SetKeywords("Lorem, Ipsum"); // Generate the PDF file $mpdf->Output('arabic.pdf', 'F'); // Stop mPDF exit; ?>
/** * Set PDF Meta Author. * * @param string $str The page author * * @return PdfInterface The current instance */ public function setMetaAuthor(string $str) : PdfInterface { $this->setProperty('metaAuthor', $str); $this->mpdf->SetAuthor($this->metaAuthor); return $this; }
<?php /* Supply Status Report Will print out all supply types, list the Min/Max/Current quantities along with current locations */ require_once "db.inc.php"; require_once "facilities.inc.php"; require_once "mpdf/mpdf.php"; /* Version 1.0 of this report has no selectable parameters - you just get a complete dump */ $mpdf = new mPDF('win-1252', 'A4', '', '', 20, 15, 48, 25, 10, 10); $mpdf->useOnlyCoreFonts = true; // false is default //$mpdf->SetProtection(array('print')); $mpdf->SetTitle($config->ParameterArray["OrgName"] . " " . __("Supply Status Report")); $mpdf->SetAuthor($config->ParameterArray["OrgName"]); $mpdf->SetDisplayMode('fullpage'); $mpdf->useActiveForms = true; $sup = new Supplies(); $bin = new SupplyBin(); $bc = new BinContents(); $SupplyList = $sup->GetSuppliesList(); $html = ' <html> <head> <style> body {font-family: sans-serif; font-size: 10pt; } p { margin: 0pt; } td { vertical-align: top; }
function email($purchase_id, $to, $cc = NULL, $bcc = NULL, $from_name, $from, $subject, $note) { $data['message'] = validation_errors() ? validation_errors() : $this->session->flashdata('message'); $data['rows'] = $this->inventories_model->getAllInventoryItems($purchase_id); $inv = $this->inventories_model->getInventoryByPurchaseID($purchase_id); $supplier_id = $inv->supplier_id; $data['supplier'] = $this->inventories_model->getSupplierByID($supplier_id); $data['inv'] = $inv; $data['pid'] = $purchase_id; $data['page_title'] = $this->lang->line("inventory"); $html = $this->load->view('view_inventory', $data, TRUE); $this->load->library('MPDF/mpdf'); $mpdf = new mPDF('utf-8', 'A4', '12', '', 10, 10, 10, 10, 9, 9); $mpdf->useOnlyCoreFonts = true; $mpdf->SetProtection(array('print')); $mpdf->SetTitle(SITE_NAME); $mpdf->SetAuthor(SITE_NAME); $mpdf->SetCreator(SITE_NAME); $mpdf->SetDisplayMode('fullpage'); $mpdf->SetAutoFont(); $stylesheet = file_get_contents('assets/css/bootstrap-' . THEME . '.css'); $mpdf->WriteHTML($stylesheet, 1); $search = array("<div class=\"row-fluid\">", "<div class=\"span6\">"); $replace = array("<div style='width: 100%;'>", "<div style='width: 48%; float: left;'>"); $html = str_replace($search, $replace, $html); $name = $this->lang->line("inventory") . "-" . $inv->id . ".pdf"; $mpdf->WriteHTML($html); $mpdf->Output($name, 'F'); if ($note) { $message = html_entity_decode($note) . "<br><hr>" . $html; } else { $message = $html; } $this->load->library('email'); $config['mailtype'] = 'html'; $config['wordwrap'] = TRUE; $this->email->initialize($config); $this->email->from($from, $from_name); $this->email->to($to); if ($cc) { $this->email->cc($cc); } if ($bcc) { $this->email->bcc($bcc); } $this->email->subject($subject); $this->email->message($message); $this->email->attach($name); if ($this->email->send()) { // email sent unlink($name); return true; } else { //email not sent unlink($name); //echo $this->email->print_debugger(); return false; } }
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'); } } } }
</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;
/** * 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); }
* 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');
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; }
public function generateInvoice($id) { $order = $this->getOrder($id); $CompanySettings = $this->em->getRepository('MeVisaERPBundle:CompanySettings')->find(1); $invoice = new \MeVisa\ERPBundle\Entity\Invoices(); $invoice->setCreatedAt(new \DateTime()); $order->addInvoice($invoice); $this->em->persist($invoice); $this->em->flush(); $products = $order->getOrderProducts(); $productsLine = array(); foreach ($products as $product) { $productsLine[] = $product->getProduct()->getName(); } $productsLine = implode(',', $productsLine); $myProjectDirectory = __DIR__ . '/../../../../'; $invoiceName = 'mevisa-invoice-' . $order->getNumber() . '-' . $invoice->getId() . '.pdf'; $invoicePath = $myProjectDirectory . 'web/invoices/'; $pdfInvoiceHTML = $this->templating->render('MeVisaERPBundle:Orders:pdfinvoice.html.twig', array('order' => $order, 'invoice' => $invoice, 'companySettings' => $CompanySettings)); $pdfAgreementHTML = $this->templating->render('MeVisaERPBundle:Orders:pdfagreement.html.twig', array('order' => $order, 'productsLine' => $productsLine, 'invoice' => $invoice, 'companySettings' => $CompanySettings)); $pdfWaiverHTML = $this->templating->render('MeVisaERPBundle:Orders:pdfwaiver.html.twig', array('order' => $order, 'invoice' => $invoice, 'companySettings' => $CompanySettings)); $mpdf = new \mPDF("ru-RU", "A4"); $mpdf->SetTitle("MeVisa Invoice " . $order->getNumber() . '-' . $invoice->getId()); $mpdf->SetAuthor($CompanySettings->getName()); $mpdf->WriteHTML($pdfInvoiceHTML); $mpdf->AddPage(); $mpdf->WriteHTML($pdfAgreementHTML); $mpdf->AddPage(); $mpdf->WriteHTML($pdfWaiverHTML); $mpdf->Output($invoicePath . $invoiceName, 'F'); $this->em->flush(); }
<?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); } }
public function setAuthor($strAuthor) { $this->objPdf->SetAuthor($strAuthor); }
<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;
/** * 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); }