当前位置: 首页>>代码示例>>PHP>>正文


PHP mPDF::SetJS方法代码示例

本文整理汇总了PHP中mPDF::SetJS方法的典型用法代码示例。如果您正苦于以下问题:PHP mPDF::SetJS方法的具体用法?PHP mPDF::SetJS怎么用?PHP mPDF::SetJS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mPDF的用法示例。


在下文中一共展示了mPDF::SetJS方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: TwoPages

    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;
//==============================================================
//==============================================================
//==============================================================
//==============================================================
开发者ID:GarryVeles,项目名称:Artibaltika,代码行数:31,代码来源:example58_new_mPDF_v5-4_features.php

示例2: crear_pdf_restaurant

 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;
 }
开发者ID:MASTERPC-CIA,项目名称:pventa,代码行数:22,代码来源:generate_pdf.php

示例3:

$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;
//==============================================================
//==============================================================
//==============================================================
//==============================================================
开发者ID:ittiwat,项目名称:dpf_project,代码行数:31,代码来源:example57_new_mPDF_v5-3_active_forms.php

示例4: mPDF

<?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;							
					}
				});
				
				
		});					   
开发者ID:adem-team,项目名称:advanced,代码行数:31,代码来源:pdfTester++-+ver+jsignature.php

示例5: printCashQuotation

 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');
 }
开发者ID:leesaw,项目名称:pradit.V2,代码行数:29,代码来源:managebill.php

示例6: PDF_processing

 /**
  * 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);
//.........这里部分代码省略.........
开发者ID:vfontjr,项目名称:formidable-pro-pdf-extended,代码行数:101,代码来源:pdf-render.php

示例7: mPDF

 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');
 }
开发者ID:leesaw,项目名称:pradit.V2,代码行数:35,代码来源:managepurchase.php

示例8: printStockOut

 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');
 }
开发者ID:leesaw,项目名称:pradit.V2,代码行数:37,代码来源:managestock.php


注:本文中的mPDF::SetJS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。