header("Content-Type: text/plain"); header("Content-Length: " . filesize($file)); header("Content-Disposition: attachment; filename='" . $file . "'"); readfile($file); exit; } //============================================================== $mpdf->useActiveForms = true; $mpdf->bookmarkStyles = array(0 => array('color' => array(0, 64, 128), 'style' => 'B'), 1 => array('color' => array(128, 0, 0), 'style' => ''), 2 => array('color' => array(0, 128, 0), 'style' => 'I')); $mpdf->useKerning = true; // set this to improve appearance of Circular text // must be set before the font is first loaded $mpdf->WriteHTML($html); // JAVASCRIPT FOR WHOLE DOCUMENT $mpdf->SetJS(' function TwoPages() { this.layout="TwoColumnRight"; this.zoomType = zoomtype.fitW; } function OnePage() { this.layout="SinglePage"; this.zoom = 100; } '); // OUTPUT $mpdf->Output(); exit; //============================================================== //============================================================== //============================================================== //==============================================================
public function crear_pdf_restaurant($id_comanda, $tipo_doc) { $this->ci->load->library('mpdf60/mpdf'); // print_r($data_json); // die(); $data['data'] = json_encode($this->objComanda->select_id($id_comanda)); $mpdf = new mPDF(); if ($tipo_doc === 'COMANDA') { //$mpdf->SetJS('this.print();'); $mpdf->WriteHTML($this->ci->load->view('comanda_print_pdf', $data, true)); $script = "window.print();"; $mpdf->SetJS($script); $mpdf->Output('comanda_prueba' . '.pdf', 'F'); } else { $stylesheet = file_get_contents('./resources/bootstrap-3.2.0/css/bootstrap.min.css'); $mpdf->WriteHTML($stylesheet, 1); $mpdf->WriteHTML($this->ci->load->view('common/comprobantes/factura_venta', $data, true)); $mpdf->SetJS('window.print(); window.close();'); $mpdf->Output('./resources/facturaspdf/' . $id_comanda . '.pdf'); } return $mpdf; }
private function newPrint($customer_id, $post_device, $post_user, $comment, $username, $randomcode, $date) { $html = ' <style> body, div, p { font-family: \'DejaVu Sans Condensed\'; font-size: 8pt; } .gradient { border:0.1mm solid #220044; background-color: #f0f2ff; background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5; box-shadow: 0.3em 0.3em #888888; } h4 { font-weight: bold; margin-top: 1em; margin-bottom: 0.3em; margin-top: 0; } div.text { padding:0.8em; margin-bottom: 0.7em; } p { margin: 0.25em 0; } p.code { background-color: #e5e5e5; margin: 1em 1cm; padding: 0 0.3cm; border:0.2mm solid #000088; box-shadow: 0.3em 0.3em #888888; } p.example, div.example { background-color: #eeeeee; margin: 0.3em 1em 1em 1em; padding: 0 0.3cm; border:0.2mm solid #444444; } .code { font-family: monospace; font-size: 9pt; } .shadowtitle { height: 8mm; background-color: #EEDDFF; background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5; padding: 0.8em; padding-left: 3em; font-family:sans; font-size: 26pt; font-weight: bold; border: 0.2mm solid white; border-radius: 0.2em; box-shadow: 0 0 1em 0.5em rgba(0,0,255,0.5); color: #AAAACC; text-shadow: 0.03em 0.03em #666, 0.05em 0.05em rgba(127,127,127,0.5), -0.015em -0.015em white; } h3 { margin: 3em 0 2em -15mm; background-color: #EEDDFF; background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5; padding: 0.5em; padding-left: 3em; width: 50%; font-family:sans; font-size: 16pt; font-weight: bold; border-left: none; border-radius: 0 2em 2em 0; box-shadow: 0 0 2em 0.5em rgba(255,0,0,1); text-shadow: 0.05em 0.04em rgba(127,127,127,0.5); } .css { font-family: arial; font-style: italic; color: #000088; } table.fontinfo { border-collapse:collapse; } table.fontinfo td { vertical-align: top; border: 0.2mm solid #BBBBBB; padding: 0.2em; } table.fontinfo thead td { text-align: center; font-weight: bold; } </style> <body> <table width="100%" border="0" cellspacing="0" cellpadding="5"> <tbody> <tr> <td><p style="font-size:11pt;">SERVISNI LIST - REVERS</p></td> <td colspan="2" align="right"><p>GAMEBOX, Cara Dušana 47, Niš - tel 018/514-666 - 060/514-666-0</p></td> <td width="12%" rowspan="10" align="center"><img src="' . Mage::getBaseDir('media') . "/pdf/gbr_small.jpg" . '"><br /><br /> <barcode code="http://proveraservisa.gamebox.co.rs/?kk=' . $randomcode . '" type="QR" class="barcode" size="0.8" error="H" /> </td> </tr> <tr> <td valign="bottom" style="border-bottom: 1px solid #000;" width="30%">Naziv uredjaja</td> <td valign="bottom" style="border-bottom: 1px solid #000;" width="30%">Serijski broj</td> <td valign="bottom" style="border-bottom: 1px solid #000;" width="30%">Opis kvara</td> </tr>'; $i = 1; foreach ($post_device as $key => $post) { $html .= '<tr> <td style="height:25px; border-left: 1px solid #000;">' . $i . '. ' . $post["name"] . '</td> <td>' . $post["sn"] . '</td> <td style="border-right: 1px solid #000;">' . $post["description"] . '</td> </tr>'; $i++; } $html .= '<tr> <td valign="bottom" style="border-top: 1px solid #000;" colspan="3">Dodatna uputstva / komentari</td> </tr> <tr> <td style="height:25px; border: 1px solid #000;" colspan="3">' . $comment . '</td> </tr> <tr> <td colspan="3">Na servis predao:</td> </tr> <tr> <td valign="top">Ime: ' . $post_user["name"] . '</td> <td valign="top"colspan="2">Datum i vreme prijema: ' . $date . '</td> </tr> <tr> <td valign="top">E-mail: ' . $post_user["email"] . '</td> <td valign="top" colspan="2">Kontrolni kod: ' . $randomcode . '</td> </tr> <tr> <td valign="top">Telefon: ' . $post_user["phone"] . '</td> <td valign="top" colspan="2">Pratite stanje Vašeg uredjaja na servisu.<br>Posetite <b>http://proveraservisa.gamebox.co.rs/</b> i unesite Vaš kontrolni kod<br />ili skenirajte <b>QR</b> kod pomocu Vašeg mobilnog telefona</td> </tr> <tr> <td colspan="3" align="center" valign="center"> <table border="0"> <tr> <td style="border: 1px solid #000;width:500px;height:40px;font-weight: bold;font-size:9pt;">' . Mage::getStoreConfig("servisnilist/text/upozorenje") . '</td> </tr> </table> </td> </tr> <tr> <td colspan="4" style="height:60px;"> <img height="10px" src="' . Mage::getBaseDir('media') . "/pdf/cut-here.png" . '"> </td> </tr> <tr> <td><p style="font-size:11pt;">SERVISNI LIST - REVERS</p></td> <td colspan="2" align="right"><p>GAMEBOX, Cara Dušana 47, Niš - tel 018/514-666 - 060/514-666-0</p></td> <td width="12%" rowspan="10" align="center" valign="top"> <barcode code="' . Mage::getBaseUrl() . 'servisnilist/status/qr/slid/' . $customer_id . '" type="QR" class="barcode" size="0.8" error="H" /> </td> </tr> <tr> <td valign="bottom" style="border-bottom: 1px solid #000;" width="30%">Naziv uredjaja</td> <td valign="bottom" style="border-bottom: 1px solid #000;" width="30%">Serijski broj</td> <td valign="bottom" style="border-bottom: 1px solid #000;" width="30%">Opis kvara</td> </tr>'; $i = 1; foreach ($post_device as $key => $post) { $html .= '<tr> <td style="height:25px; border-left: 1px solid #000;">' . $i . '. ' . $post["name"] . '</td> <td>' . $post["sn"] . '</td> <td style="border-right: 1px solid #000;">' . $post["description"] . '</td> </tr>'; $i++; } $html .= '<tr> <td valign="bottom" style="border-top: 1px solid #000;" colspan="3">Dodatna uputstva / komentari</td> </tr> <tr> <td style="height:25px; border: 1px solid #000;" colspan="3">' . $comment . '</td> </tr> <tr> <td colspan="3" style="padding:0px;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td valign="bottom" style="height:25px;" width="60%">Materijal</td> <td valign="bottom">j. mere</td> <td valign="bottom">kolicina</td> <td valign="bottom">cena</td> <td valign="bottom">UKUPNO</td> </tr> <tr> <td style="border: 1px solid #000; height:20px;"> </td> <td style="border: 1px solid #000;"> </td> <td style="border: 1px solid #000;"> </td> <td style="border: 1px solid #000;"> </td> <td style="border: 1px solid #000;"> </td> </tr> <tr> <td valign="bottom" style="height:25px;">Opis usluge</td> <td valign="bottom">j. mere</td> <td valign="bottom">kolicina</td> <td valign="bottom">cena</td> <td valign="bottom">UKUPNO</td> </tr> <tr> <td style="border: 1px solid #000; height:20px;"> </td> <td style="border: 1px solid #000;"> </td> <td style="border: 1px solid #000;"> </td> <td style="border: 1px solid #000;"> </td> <td style="border: 1px solid #000;"> </td> </tr> <tr> <td></td> <td></td> <td colspan="3" style="border-bottom: 1px solid #000;height:30px;">SVEGA:</td> </tr> </tbody> </table> </td> </tr> <tr> <td colspan="3">Na servis predao:</td> </tr> <tr> <td valign="top">Ime: ' . $post_user["name"] . '</td> <td valign="top" colspan="2">Datum i vreme prijema: ' . $date . '</td> </tr> <tr> <td valign="top">E-mail: ' . $post_user["email"] . '</td> <td valign="top">Kontrolni kod: ' . $randomcode . '</td> <td valign="top"><barcode code="' . $randomcode . '" type="C128B" class="barcode" height="0.5"/></td> </tr> <tr> <td valign="top">Telefon: ' . $post_user["phone"] . '</td> <td valign="top" colspan="2">Potpis: ________________________________</td> </tr> </tbody> </table> </body> '; include Mage::getBaseDir('lib') . '/mpdf60/mpdf.php'; $mpdf = new mPDF('c', 'A4', '', '', 8, 8, 8, 8, 8, 8); $mpdf->WriteHTML($html); $mpdf->SetJS('print();'); $mpdf->Output(); exit; }
</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->SetJS('print();'); $mpdf->SetDisplayMode('fullpage'); $mpdf->WriteHTML($html); $mpdf->Output(); exit; exit;
/** * Creates the PDF and does a specific output (see PDF_Generator function above for $output variable types) */ public function PDF_processing($html, $filename, $id, $output = 'view', $arguments) { /* * DOMPDF replaced with mPDF in v3.0.0 * Check which version of mpdf we are calling * Full, Lite or Tiny */ if (!class_exists('mPDF')) { if (FP_PDF_ENABLE_MPDF_TINY === true) { include FP_PDF_PLUGIN_DIR . '/mPDF/mpdf-extra-lite.php'; } elseif (FP_PDF_ENABLE_MPDF_LITE === true) { include FP_PDF_PLUGIN_DIR . '/mPDF/mpdf-lite.php'; } else { include FP_PDF_PLUGIN_DIR . '/mPDF/mpdf.php'; } } /* * Initialise class and set the paper size and orientation */ $paper_size = $arguments['pdf_size']; if (!is_array($paper_size)) { $orientation = $arguments['orientation'] == 'landscape' ? '-L' : ''; $paper_size = $paper_size . $orientation; } else { $orientation = $arguments['orientation'] == 'landscape' ? 'L' : 'P'; } $mpdf = new mPDF('', $paper_size, 0, '', 15, 15, 16, 16, 9, 9, $orientation); /* * Display PDF is full-page mode which allows the entire PDF page to be viewed * Normally PDF is zoomed right in. */ $mpdf->SetDisplayMode('fullpage'); if (FP_PDF_ENABLE_SIMPLE_TABLES === true) { $mpdf->simpleTables = true; } /* * Automatically detect fonts and substitue as needed */ if (FP_PDF_DISABLE_FONT_SUBSTITUTION === true) { $mpdf->useSubstitutions = false; } else { $mpdf->SetAutoFont(AUTOFONT_ALL); $mpdf->useSubstitutions = true; } /* * Set Creator Meta Data */ $mpdf->SetCreator('Formidable Pro PDF Extended v' . FP_PDF_EXTENDED_VERSION . '. http://formidablepropdfextended.com'); /* * Set RTL languages at user request */ if ($arguments['rtl'] === true) { $mpdf->SetDirectionality('rtl'); } /* * Set up security if user requested */ if ($arguments['security'] === true && $arguments['pdfa1b'] !== true && $arguments['pdfx1a'] !== true) { $password = strlen($arguments['pdf_password']) > 0 ? $arguments['pdf_password'] : ''; $master_password = strlen($arguments['pdf_master_password']) > 0 ? $arguments['pdf_master_password'] : null; $pdf_privileges = is_array($arguments['pdf_privileges']) ? $arguments['pdf_privileges'] : array(); $mpdf->SetProtection($pdf_privileges, $password, $master_password, 128); } /* PDF/A1-b support added in v3.4.0 */ if ($arguments['pdfa1b'] === true) { $mpdf->PDFA = true; $mpdf->PDFAauto = true; } else { if ($arguments['pdfx1a'] === true) { $mpdf->PDFX = true; $mpdf->PDFXauto = true; } } /* * Check if we should auto prompt to print the document on open */ if (isset($_GET['print'])) { $mpdf->SetJS('this.print();'); } /* load HTML block */ $mpdf->WriteHTML($html); switch ($output) { case 'download': $mpdf->Output($filename, 'D'); exit; break; case 'view': $mpdf->Output(time(), 'I'); exit; break; case 'save': /* * PDF wasn't writing to file with the F method - http://mpdf1.com/manual/index.php?tid=125 * Return as a string and write to file manually */ $pdf = $mpdf->Output('', 'S'); return $this->savePDF($pdf, $filename, $id); break; } }
$mpdf->form_background_color = '0.941 0.941 0.941'; $mpdf->form_border_width = '1'; $mpdf->form_border_style = 'S'; $mpdf->form_radio_color = '0.0 0.820 0.0'; $mpdf->form_radio_background_color = '0.941 0.5 0.5'; $mpdf->form_button_border_color = '0.0 0.820 0.0'; $mpdf->form_button_background_color = '0.941 0.941 0.941'; $mpdf->form_button_border_width = '1'; $mpdf->form_button_border_style = 'S'; */ $mpdf->WriteHTML($html); //============================================================== // JAVASCRIPT FOR WHOLE DOCUMENT $mpdf->SetJS(' var dialogTitle = "Enter details"; var defaultAnswer = ""; var reply = app.response("This is javascript set to run when the document opens. Enter value for first field", dialogTitle, defaultAnswer); if (reply != null) { this.getField("inputfield").value = reply; } '); //============================================================== // OUTPUT $mpdf->Output(); exit; //============================================================== //============================================================== //============================================================== //==============================================================
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\helpers\Url; use yii\helpers\Json; use yii\widgets\DetailView; use lukisongroup\master\models\Unitbarang; /* use lukisongroup\assets\AppAssetJquerySignature_1_1_2; AppAssetJquerySignature_1_1_2::register($this); */ $this->title = $reqro->KD_RO; $this->params['breadcrumbs'][] = ['label' => 'Request Order', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; $this->registerJsFile('http://lukisongroup.com/angular/signature/js/jquery.min.js', ['position' => \yii\web\View::POS_HEAD], 1); $mpdf = new mPDF(); $mpdf->SetJS("print(\r\n\t\t\tvar jsonData= \$.ajax({\r\n\t\t\t url: 'http://api.lukisongroup.com/login/signatures?id=2',\r\n\t\t\t type: 'GET',\r\n\t\t\t dataType:'json',\t\t\t\r\n\t\t\t async: false\r\n\t\t\t }).responseText;\t\t \r\n\t\t\t var myData1 = jsonData;\r\n\t\t\t sig1 = myData1;\r\n\t\t\t //alert(sig);\r\n\t)"); $mpdf->SetJS('print( $(document).ready(function() { $("#svgsignature1").signature(); $("#redrawsignature1").signature(); $("#redrawsignature1").signature({disabled: true}); $("#svgsignature1").signature({ change: function(event, ui) { $("#redrawsignature1").signature("draw", sig1); var coba1=$("#redrawsignature1").signature("toSVG"); document.getElementById("ptrsvg1").innerHTML = coba1; } }); });
function printCashQuotation() { $id = $this->uri->segment(3); $this->load->library('mpdf/mpdf'); $mpdf = new mPDF('th', 'A4', '0', 'thsaraban'); $stylesheet = file_get_contents('application/libraries/mpdf/css/style.css'); $mpdf->SetHTMLHeader('<div style="text-align: left; font-weight: bold; font-size: 20pt;">บริษัท ประดิษฐ์ แอนด์ เฟรนด์ แมชีนเนอรี่ จำกัด</div><br\\><div style="text-align: left; font-weight: font-size: 16pt;">102/17-20 หมู่ 9 ถ.ท่าเรือ-พระแท่น ต.ตะคร้ำเอน อ.ท่ามะกา จ.กาญจนบุรี 71130<br>โทรศัพท์ : (034) 561641 , 562895 FAX. : (034) 562896</div>'); //$html = "ทดสอบ<br>"; $query = $this->bill->getOneQuotation($id); if ($query) { $data['bill_array'] = $query; } else { $data['bill_array'] = array(); } foreach ($query as $loop) { $bid = $loop->bid; } $query = $this->bill->getOneQuotationProduct($bid); if ($query) { $data['billproduct_array'] = $query; } else { $data['billproduct_array'] = array(); } //echo $html; $mpdf->SetJS('this.print();'); $mpdf->WriteHTML($stylesheet, 1); $mpdf->WriteHTML($this->load->view("printQuotationhtml", $data, TRUE)); $mpdf->Output('', 'I'); }
function printCashPurchase_cash() { $id = $this->uri->segment(3); $this->load->library('mpdf/mpdf'); $mpdf = new mPDF('th', 'A4', '0', 'thsaraban'); $stylesheet = file_get_contents('application/libraries/mpdf/css/style.css'); $mpdf->SetHTMLHeader('<div style="text-align: left; font-weight: bold; font-size: 20pt;">บริษัท ประดิษฐ์ แอนด์ เฟรนด์ แมชีนเนอรี่ จำกัด</div><br\\><div style="text-align: left; font-weight: font-size: 16pt;">102/17-20 หมู่ 9 ถ.ท่าเรือ-พระแท่น ต.ตะคร้ำเอน อ.ท่ามะกา จ.กาญจนบุรี 71130<br>โทรศัพท์ : (034) 561641 , 562895 FAX. : (034) 562896</div>'); //$html = "ทดสอบ<br>"; $query = $this->purchase->getOnePurchase_cash($id); if ($query) { $data['purchase_array'] = $query; } else { $data['purchase_array'] = array(); } // insert buycash id foreach ($query as $loop) { $_purchaseid = $loop->purchaseID; } // replace PO with HS $hs = substr($_purchaseid, 0, 2); $hs .= "HS"; $hs .= substr($_purchaseid, 4, 7); $data['buycashid'] = $hs; $query = $this->purchase->getOnePurchaseProduct_cash($id); if ($query) { $data['purchaseproduct_array'] = $query; } else { $data['purchaseproduct_array'] = array(); } //echo $html; $mpdf->SetJS('this.print();'); $mpdf->WriteHTML($stylesheet, 1); $mpdf->WriteHTML($this->load->view("printPurchasehtml_cash", $data, TRUE)); $mpdf->Output('', 'I'); }
function printStockOut() { $id = $this->uri->segment(3); $this->load->library('mpdf/mpdf'); $mpdf = new mPDF('th', array(203, 279), '0', 'thsaraban'); $stylesheet = file_get_contents('application/libraries/mpdf/css/styleStockout.css'); $query = $this->stock->getOneStockOUTprint($id); if ($query) { $data['stock_array'] = $query; } else { $data['stock_array'] = array(); } //$html = "ทดสอบ<br>"; /* $query = $this->bill->getOneQuotation($id); if($query){ $data['bill_array'] = $query; }else{ $data['bill_array'] = array(); } foreach($query as $loop) { $bid = $loop->bid; } $query = $this->bill->getOneQuotationProduct($bid); if($query){ $data['billproduct_array'] = $query; }else{ $data['billproduct_array'] = array(); } */ //echo $html; $mpdf->SetJS('this.print();'); $mpdf->WriteHTML($stylesheet, 1); $mpdf->WriteHTML($this->load->view("printStockOuthtml", $data, TRUE)); $mpdf->Output('', 'I'); }