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


PHP TCPDF::IncludeJS方法代码示例

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


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

示例1: testPdfOutput


//.........这里部分代码省略.........
        // set some language-dependent strings (optional)
        $pdf->setLanguageArray($this->langSettings);
        // ---------------------------------------------------------
        // IMPORTANT: disable font subsetting to allow users editing the document
        $pdf->setFontSubsetting(false);
        // set font
        $pdf->SetFont('helvetica', '', 10, '', false);
        // add a page
        $pdf->AddPage();
        /*
        It is possible to create text fields, combo boxes, check boxes and buttons.
        Fields are created at the current position and are given a name.
        This name allows to manipulate them via JavaScript in order to perform some validation for instance.
        */
        // set default form properties
        $pdf->setFormDefaultProp(array('lineWidth' => 1, 'borderStyle' => 'solid', 'fillColor' => array(255, 255, 200), 'strokeColor' => array(255, 128, 128)));
        $pdf->SetFont('helvetica', 'BI', 18);
        $pdf->Cell(0, 5, 'Example of Form', 0, 1, 'C');
        $pdf->Ln(10);
        $pdf->SetFont('helvetica', '', 12);
        // First name
        $pdf->Cell(35, 5, 'First name:');
        $pdf->TextField('firstname', 50, 5);
        $pdf->Ln(6);
        // Last name
        $pdf->Cell(35, 5, 'Last name:');
        $pdf->TextField('lastname', 50, 5);
        $pdf->Ln(6);
        // Gender
        $pdf->Cell(35, 5, 'Gender:');
        $pdf->ComboBox('gender', 30, 5, array(array('', '-'), array('M', 'Male'), array('F', 'Female')));
        $pdf->Ln(6);
        // Drink
        $pdf->Cell(35, 5, 'Drink:');
        //$pdf->RadioButton('drink', 5, array('readonly' => 'true'), array(), 'Water');
        $pdf->RadioButton('drink', 5, array(), array(), 'Water');
        $pdf->Cell(35, 5, 'Water');
        $pdf->Ln(6);
        $pdf->Cell(35, 5, '');
        $pdf->RadioButton('drink', 5, array(), array(), 'Beer', true);
        $pdf->Cell(35, 5, 'Beer');
        $pdf->Ln(6);
        $pdf->Cell(35, 5, '');
        $pdf->RadioButton('drink', 5, array(), array(), 'Wine');
        $pdf->Cell(35, 5, 'Wine');
        $pdf->Ln(6);
        $pdf->Cell(35, 5, '');
        $pdf->RadioButton('drink', 5, array(), array(), 'Milk');
        $pdf->Cell(35, 5, 'Milk');
        $pdf->Ln(10);
        // Newsletter
        $pdf->Cell(35, 5, 'Newsletter:');
        $pdf->CheckBox('newsletter', 5, true, array(), array(), 'OK');
        $pdf->Ln(10);
        // Address
        $pdf->Cell(35, 5, 'Address:');
        $pdf->TextField('address', 60, 18, array('multiline' => true, 'lineWidth' => 0, 'borderStyle' => 'none'), array('v' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'dv' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'));
        $pdf->Ln(19);
        // Listbox
        $pdf->Cell(35, 5, 'List:');
        $pdf->ListBox('listbox', 60, 15, array('', 'item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7'), array('multipleSelection' => 'true'));
        $pdf->Ln(20);
        // E-mail
        $pdf->Cell(35, 5, 'E-mail:');
        $pdf->TextField('email', 50, 5);
        $pdf->Ln(6);
        // Date of the day
        $pdf->Cell(35, 5, 'Date:');
        $pdf->TextField('date', 30, 5, array(), array('v' => date('Y-m-d'), 'dv' => date('Y-m-d')));
        $pdf->Ln(10);
        $pdf->SetX(50);
        // Button to validate and print
        $pdf->Button('print', 30, 10, 'Print', 'Print()', array('lineWidth' => 2, 'borderStyle' => 'beveled', 'fillColor' => array(128, 196, 255), 'strokeColor' => array(64, 64, 64)));
        // Reset Button
        $pdf->Button('reset', 30, 10, 'Reset', array('S' => 'ResetForm'), array('lineWidth' => 2, 'borderStyle' => 'beveled', 'fillColor' => array(128, 196, 255), 'strokeColor' => array(64, 64, 64)));
        // Submit Button
        $pdf->Button('submit', 30, 10, 'Submit', array('S' => 'SubmitForm', 'F' => 'http://localhost/printvars.php', 'Flags' => array('ExportFormat')), array('lineWidth' => 2, 'borderStyle' => 'beveled', 'fillColor' => array(128, 196, 255), 'strokeColor' => array(64, 64, 64)));
        // Form validation functions
        $js = <<<EOD
function CheckField(name,message) {
    var f = getField(name);
    if(f.value == '') {
        app.alert(message);
        f.setFocus();
        return false;
    }
    return true;
}
function Print() {
    if(!CheckField('firstname','First name is mandatory')) {return;}
    if(!CheckField('lastname','Last name is mandatory')) {return;}
    if(!CheckField('gender','Gender is mandatory')) {return;}
    if(!CheckField('address','Address is mandatory')) {return;}
    print();
}
EOD;
        // Add Javascript code
        $pdf->IncludeJS($js);
        $this->comparePdfs($pdf);
    }
开发者ID:fooman,项目名称:tcpdf,代码行数:101,代码来源:Example014Test.php

示例2: testPdfOutput

    public function testPdfOutput()
    {
        // create new PDF document
        $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        // set document information
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetAuthor('Nicola Asuni');
        $pdf->SetTitle('TCPDF Example 053');
        $pdf->SetSubject('TCPDF Tutorial');
        $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
        // set default header data
        $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 053', PDF_HEADER_STRING);
        // set header and footer fonts
        $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        // set default monospaced font
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        // set margins
        $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        // set auto page breaks
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        // set image scale factor
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
        // set some language-dependent strings (optional)
        $pdf->setLanguageArray($this->langSettings);
        // ---------------------------------------------------------
        // set font
        $pdf->SetFont('times', '', 14);
        // add a page
        $pdf->AddPage();
        // print a some of text
        $text = 'This is an example of <strong>JavaScript</strong> usage on PDF documents.<br /><br />For more information check the source code of this example, the source code documentation for the <i>IncludeJS()</i> method and the <i>JavaScript for Acrobat API Reference</i> guide.<br /><br /><a href="http://www.tcpdf.org">www.tcpdf.org</a>';
        $pdf->writeHTML($text, true, 0, true, 0);
        // write some JavaScript code
        $js = <<<EOD
app.alert('JavaScript Popup Example', 3, 0, 'Welcome');
var cResponse = app.response({
    cQuestion: 'How are you today?',
    cTitle: 'Your Health Status',
    cDefault: 'Fine',
    cLabel: 'Response:'
});
if (cResponse == null) {
    app.alert('Thanks for trying anyway.', 3, 0, 'Result');
} else {
    app.alert('You responded, "'+cResponse+'", to the health question.', 3, 0, 'Result');
}
EOD;
        // force print dialog
        $js .= 'print(true);';
        // set javascript
        $pdf->IncludeJS($js);
        // ---------------------------------------------------------
        $this->comparePdfs($pdf);
    }
开发者ID:fooman,项目名称:tcpdf,代码行数:57,代码来源:Example053Test.php

示例3: printpackagingslip


//.........这里部分代码省略.........
        $imgPath = WWW_ROOT . 'css/';
        $imageurl = Router::url('/img/source', true);
        $html = '<body>
					   <div id="label">
						  <div class="container">
							 <div class="header row">
								<div class="leftside"><img src=' . $imageurl . '/vitapure.png></div>
								<div class="rightside ">
								   <div class="barcode center">
									  &nbsp;
									  <div class="right">4584327-0</div>
									  <span class="center">4584327-0</span>
								   </div>
								</div>
							 </div>
							 <div class="cn22 row">
								<div class="leftside address">
								   <h4>Ship From:</h4>
								   <span class="bold">SPC Limited</span><br>
								   Longueville Road<br>
								   St Saviour Jersey JE2 7WF<br>
								   E: sales@vitapure.co.uk<br>
								   T: 0845 800 8888
								</div>
								<div class="rightside address">
								   <h4>Ship To:</h4>
								   <span class="bold">' . $fullname . '</span><br>
								   ' . $address1 . '<br>
								   ' . $address2 . ', ' . $address3 . ',' . $town . ', ' . $resion . ',' . $postcode . '<br>
								   ' . $country . '<br>
								   T: 07517063902<br>
								</div>
							 </div>
							 <div class="header row">
								<div class="leftside">
								   <div><span class="bold">Order No.:</span>' . $ordernumber . '</div>
								   <div><span class="bold">Order Date:</span>' . $recivedate[0] . '</div>
								</div>
								<div class="rightside">
								   <div><span class="bold">Ship Via:</span>' . $courier . '</div>
								   <div><span class="bold">Payment Method:</span>' . $paymentmethod . '</div>
								</div>
							 </div>
							 <div class="tablesection row">
								<table class="" border="1" cellpadding="5px">
								   <tr>
									  <th class="noleftborder" width="15%">Item No.</th>
									  <th valign="top" width="40%">Description of contents</th>
									  <th valign="top" class="center" width="5%">Qty</th>
									  <th valign="top" class="center" width="15%">Price</th>
									  <th valign="top" class="center norightborder" width="15%">Amount</th>
								   </tr>';
        $i = 1;
        $subtotal = 0;
        foreach ($order['items'] as $item) {
            $html .= '<tr>
									  <td valign="top" class="noleftborder">' . $i . '</td>
									  <td valign="top">' . $item->Title . '</td>
									  <td valign="top" class="center">' . $item->Quantity . '</td>
									  <td valign="top" class="right">£' . $item->PricePerUnit . '</td>
									  <td valign="top" class="right norightborder">£' . $item->CostIncTax . '</td>
										</tr>';
            $i++;
            $subtotal = $subtotal + $item->PricePerUnit;
        }
        $j = $i - 1;
        $html .= '</table>
								<div class="otherinfo">
								   <div><span class="bold">Total Item Count:</span> ' . $j . '</div>
								   <div><span class="bold">Payment Reference:</span> 4G073562WB731302E</div>
								</div>
								<div class="totalprice">
								   <div class="leftside right">Sub Total</div>
								   <div class="rightside right">£' . $subtotal . '</div>
								   <div class="leftside right">Shipping</div>
								   <div class="rightside right">£9.25</div>
								   <div class="leftside right">Tax</div>
								   <div class="rightside right">£0.00</div>
								   <div class="leftside right">Discount</div>
								   <div class="rightside right">£0.00</div>
								   <div class="leftside right">Other Charges</div>
								   <div class="rightside right">£0.00</div>
								   <div class="leftside right bold">Order Total</div>
								   <div class="rightside right bold">£166.21</div>
								</div>
							 </div>
							 <div class="footer row">
								Thanks for shopping with us. It was a pleasure to serve you.
								Get special 5% off on next purchase by using promo code: WELCOMEBACK
							 </div>
						  </div>
					   </div>
					</body>';
        $html .= '<style>' . file_get_contents($imgPath . 'packing.css') . '</style>';
        //echo $html;
        $pdf->writeHTML($html, true, false, true, false, '');
        $js = 'print(true);';
        $pdf->IncludeJS($js);
        $pdf->Output('Service_' . $date . '.pdf', 'D');
    }
开发者ID:agashish,项目名称:test_new,代码行数:101,代码来源:old_CronjobsController.php

示例4: printpackagingslip


//.........这里部分代码省略.........
</td>
</tr>
</table>
<div class="">

</div>
<table class="header row">
<tr>
<td class="leftside"><span class="bold">Order No.:</span> 149680

</td>
<td><span class="bold">Ship Via:</span> Jersey Post</td>
</tr>
<tr>
<td class="rightside">
<span class="bold">Payment Method:</span> Paypal
</td>
<td><span class="bold">Order Date:</span> 23/09/2015</td>
</tr>
</table>

<div class="">
<table class="tablesection row" border="1" cellpadding="5px" cellspacing="0">
<tr>
<th class="" width="15%">Item No.</th>
<th valign="top" width="40%">Description of contents</th>
<th valign="top" class="center" width="15%">Qty</th>
<th valign="top" class="center" width="15%">Price</th>
<th valign="top" class="center " width="15%">Amount</th>
</tr>
<tr>
<td valign="top" class="">0001</td>
<td valign="top">Playtex Drop Ins Pre Sterilized Soft Bottle Liners, 8-10 oz. 100 ea</td>
<td valign="top" class="center">2</td>
<td valign="top" class="right">£75.00</td>
<td valign="top" class="right ">£150.00</td>
</tr>
<tr>
<td valign="top" class="">0002</td>
<td valign="top">Now Foods, Calcium Hydroxyapatite 250mg 120 Capsules</td>
<td valign="top" class="center">1</td>
<td valign="top" class="right">£6.96</td>
<td valign="top" class="right ">£6.96</td>
</tr>

</table>
<table>
<tr>
<td class="otherinfo">
<div><span class="bold">Total Item Count:</span> 3</div>
<div><span class="bold">Payment Reference:</span> 4G073562WB731302E</div></td>
<td class="totalprice">
<table>
<tr>
<td class="leftside right">Sub Total</td>
<td class="rightside right">£156.96</td>
</tr>
<tr>
<td class="leftside right">Shipping</td>
<td class="rightside right">£9.25</td>
</tr>
<tr>
<td class="leftside right">Tax</td>
<td class="rightside right">£0.00</td>
</tr>
<tr>
<td class="leftside right">Discount</td>
<td class="rightside right">£0.00</td>
</tr>
<tr>
<td class="leftside right">Other Charges</td>
<td class="rightside right">£0.00</td>
</tr>
<tr>
<td class="leftside right bold">Order Total</td>
<td class="rightside right bold">£166.21</td>
</tr>
</table>
</td>
</tr>
</table>


</div>
<div class="footer row">
Thanks for shopping with us. It was a pleasure to serve you.
Get special 5% off on next purchase by using promo code: WELCOMEBACK
</div>

</div>
</div>

</body>';
        //$html .= '<style>'.file_get_contents($imgPath.'packing.css').'</style>';
        //echo $html;
        $pdf->writeHTML($html, true, false, true, false, '');
        $js = 'print(true);';
        $pdf->IncludeJS($js);
        $pdf->Output('Service_' . $date . '.pdf', 'D');
    }
开发者ID:agashish,项目名称:warehouse,代码行数:101,代码来源:CronjobsController.php

示例5: array

$pdf->ComboBox('gender', 10, 5, array('', 'M', 'F'), array('strokeColor' => 'ltGray'));
$pdf->Ln(6);
//Drink
$pdf->Cell(35, 5, 'Drink:');
$pdf->RadioButton('drink', 5, false);
$pdf->Cell(35, 5, 'Water');
$pdf->Ln(6);
$pdf->Cell(35, 5, '');
$pdf->RadioButton('drink', 5, false);
$pdf->Cell(35, 5, 'Beer');
$pdf->Ln(6);
$pdf->Cell(35, 5, '');
$pdf->RadioButton('drink', 5, false);
$pdf->Cell(35, 5, 'Wine');
// set export values
$pdf->IncludeJS("fdrink.exportValues=[\"Water\", \"Beer\", \"Wine\"];\n");
// check the second radiobutton
$pdf->IncludeJS("fdrink.checkThisBox(1,true);\n");
$pdf->Ln(10);
//Gender
$pdf->Cell(35, 5, 'List:');
$pdf->ListBox('listbox', 60, 15, array('', 'item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7'), array('multipleSelection' => 'true'));
$pdf->Ln(20);
//Adress
$pdf->Cell(35, 5, 'Address:');
$pdf->TextField('address', 60, 18, array('multiline' => true, 'strokeColor' => 'ltGray'));
$pdf->Ln(19);
//E-mail
$pdf->Cell(35, 5, 'E-mail:');
$pdf->TextField('email', 50, 5, array('strokeColor' => 'ltGray'));
$pdf->Ln(6);
开发者ID:arhe,项目名称:pwak,代码行数:31,代码来源:example_014.php

示例6:

$pdf->SetFont('times', '', 14);
// add a page
$pdf->AddPage();
// print a some of text
$text = 'This is an example of <strong>JavaScript</strong> usage on PDF documents.<br /><br />For more information check the source code of this example, the source code documentation for the <i>IncludeJS()</i> method and the <i>JavaScript for Acrobat API Reference</i> guide.<br /><br /><a href="http://www.tcpdf.org">www.tcpdf.org</a>';
$pdf->writeHTML($text, true, 0, true, 0);
// write some JavaScript code
$js = <<<EOD
app.alert('JavaScript Popup Example', 3, 0, 'Welcome');
var cResponse = app.response({
\tcQuestion: 'How are you today?',
\tcTitle: 'Your Health Status',
\tcDefault: 'Fine',
\tcLabel: 'Response:'
});
if (cResponse == null) {
\tapp.alert('Thanks for trying anyway.', 3, 0, 'Result');
} else {
\tapp.alert('You responded, "'+cResponse+'", to the health question.', 3, 0, 'Result');
}
EOD;
// force print dialog
$js .= 'print(true);';
// set javascript
$pdf->IncludeJS($js);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_053.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
开发者ID:hunde,项目名称:bsc,代码行数:31,代码来源:example_053.php

示例7: ucwords

        <td width="4%">:</td>
        <td class="datapasien">' . ucwords($pendaftaran->nama_lengkap) . '</td>
    </tr>
    <tr>
        <th>TTL</th>
        <td width="4%">:</td>
        <td class="datapasien">' . ucwords($pendaftaran->tpt_lahir) . ', ' . date("d-m-Y", strtotime($pendaftaran->tgl_lahir)) . '</td>
    </tr>
    <tr>
        <th>ALAMAT</th>
        <td width="4%">:</td>
        <td class="datapasien">' . $pendaftaran->jalan_1 . '</td>
    </tr>
    <tr>
        <th class="perhatian" width="56%">PERHATIAN<br/>
            <small>1. Setiap kali berobat di RSUD Serui, kartu ini harus selalu dibawa.<br/>
            2. Kartu berobat ini tidak dipergunakan oleh orang lain.<br/>
            3. Apabila kartu ini hilang mohon dilaporkan ke loket adm RSUD.</small>
        </th>
        <td class="ttd" width="44%">
            Serui, 03 Maret 2015<br/>Penanggung Jawab Adm Pelayanan<br/>TTD<br/><strong>PIGELUS REMATOBI</strong><br/>NIP. 19862805 200909 1 001
        </td>
    </tr>
</table>';
// force print dialog
$js .= 'print(true);';
// set javascript
$obj_pdf->IncludeJS($js);
ob_end_clean();
$obj_pdf->writeHTML($content, true, false, true, false, '');
$obj_pdf->Output('pendaftaran.pdf', 'I');
开发者ID:ibnoe,项目名称:rsudapp,代码行数:31,代码来源:pdfdaftar.php

示例8: tcpdf

    public function tcpdf()
    {
        $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetAuthor('Nicola Asuni');
        $pdf->SetTitle('TCPDF Example 053');
        $pdf->SetSubject('TCPDF Tutorial');
        $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
        $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 053', PDF_HEADER_STRING);
        $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
        if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
            require_once dirname(__FILE__) . '/lang/eng.php';
            $pdf->setLanguageArray($l);
        }
        $pdf->SetFont('times', '', 14);
        $pdf->AddPage();
        $text = 'This is an example of <strong>JavaScript</strong> usage on PDF documents.<br /> <br />For more information check the source code of this example, the source code documentation for the <i>IncludeJS() </i> method and the <i>JavaScript for Acrobat API Reference</i> guide.<br /><br /><a href="http://www.tcpdf.org">www.tcpdf.org</a>';
        $pdf->writeHTML($text, true, 0, true, 0);
        $js = <<<EOD
        app.alert('JavaScript Popup Example', 3, 0, 'Welcome');
var cResponse = app.response({ cQuestion: 'How are you today?', cTitle: 'Your Health Status', cDefault: 'Fine', cLabel: 'Response:' });
if (cResponse == null) { app.alert('Thanks for trying anyway.', 3, 0, 'Result');
} else { app.alert('You responded, "'+cResponse+'", to the health question.', 3, 0, 'Result');
}
EOD;
        $js .= 'print(true);';
        $pdf->IncludeJS($js);
        $pdf->Output('example_053.pdf', 'D');
        //   $pdf=new TCPDF();
        //        $pdf->Addpge('P','A4');
        //        $html='<html>
        //                <head></head>
        //                <body><table border="1">
        //                <tr><th>name</th>
        //                <th>company</th></tr>
        //                <tr>
        //                <td>helllo</td>
        //                <td>xx technologies</td>
        //                </tr>
        //                </table>
        //                </body>
        //                </html>';
        //
        //        $pdf->writeHTML($html, true,
        //                false, true, false, '');
        //        $pdf->Output();
        //
    }
开发者ID:renztoygwapo,项目名称:csr,代码行数:55,代码来源:home.php

示例9: array

//Adress
$pdf->Cell(35, 5, 'Address:');
$pdf->TextField('address', 60, 18, array('multiline' => true, 'BorderColor' => 'ltGray'));
$pdf->Ln(19);
//E-mail
$pdf->Cell(35, 5, 'E-mail:');
$pdf->TextField('email', 50, 5, array('BorderColor' => 'ltGray'));
$pdf->Ln(6);
//Newsletter
$pdf->Cell(35, 5, 'Receive our', 0, 1);
$pdf->Cell(35, 5, 'newsletter:');
$pdf->CheckBox('newsletter', 5, true);
$pdf->Ln(10);
//Date of the day (determined and formatted by JS)
$pdf->Write(5, 'Date: ');
$pdf->TextField('date', 30, 5);
$pdf->IncludeJS("getField('date').value=util.printd('dd/mm/yyyy',new Date());");
$pdf->Ln();
$pdf->Write(5, 'Signature:');
$pdf->Ln(3);
//Button to validate and print
$pdf->SetX(95);
$pdf->Button('print', 20, 8, 'Print', 'Print()', array('TextColor' => 'yellow', 'FillColor' => '#FF5050'));
//Form validation functions
$pdf->IncludeJS("\r\nfunction CheckField(name,message)\r\n{\r\n    f=getField(name);\r\n    if(f.value=='')\r\n    {\r\n        app.alert(message);\r\n        f.setFocus();\r\n        return false;\r\n    }\r\n    return true;\r\n}\r\n\r\nfunction Print()\r\n{\r\n    //Validation\r\n    if(!CheckField('firstname','First name is mandatory'))\r\n        return;\r\n    if(!CheckField('lastname','Last name is mandatory'))\r\n        return;\r\n    if(!CheckField('gender','Gender is mandatory'))\r\n        return;\r\n    if(!CheckField('address','Address is mandatory'))\r\n        return;\r\n    //Print\r\n    print();\r\n}\r\n");
// END JAVASCRIPT FORM --------------------------------------
//Close and output PDF document
$pdf->Output();
//============================================================+
// END OF FILE
//============================================================+
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:31,代码来源:test_unicode.php

示例10: imprimeCupomEntrada

    public function imprimeCupomEntrada()
    {
        $objEmpresa = new fla_empresas();
        global $path_relative;
        $arrEmpresa = array();
        $arrRotatividade = array();
        $objModelo = new fla_modelos();
        $objCliente = new fla_clientes();
        $arrEmpresa = $objEmpresa->buscaEmpresas($objEmpresa);
        $pdf = new TCPDF("P", PDF_UNIT, 'ETIQUETA', true, 'IBM850', false);
        //$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        $pdf->SetMargins(0, 0, 0, true);
        //$pdf->SetMargins(PDF_MARGIN_LEFT,PDF_MARGIN_TOP,PDF_MARGIN_RIGHT);
        $pdf->setPrintHeader(false);
        $pdf->setPrintFooter(false);
        $pdf->AddPage();
        // $nom_prestador  = limitar($arrEmpresa[0]['nom_fantasia'],25);
        $nom_prestador = $arrEmpresa[0]['nom_fantasia'];
        $end_prestador = $arrEmpresa[0]['des_endereco'];
        $tel_prestador = $arrEmpresa[0]['num_telefone'];
        $tel_prestador = mascara_string("(##) ####-####", $tel_prestador);
        $horario_atendimento = "Horario de atendimento:\r\n07:00hrs as 19:00hrs";
        $multa = "A perda deste cupom implicara \r\nem multa de R\$ 10,00";
        $arrRotatividade = $this->buscaCarro($this);
        $cod_cartao = $arrRotatividade[0]['cod_cartao'];
        $hora_entrada = $arrRotatividade[0]['hor_entrada'];
        $dat_entrada = mostraData($arrRotatividade[0]['dat_cadastro']);
        $des_placa = strtoupper($arrRotatividade[0]['des_placa']);
        $objCliente->set_des_placa($des_placa);
        $arrCliente = $objCliente->buscaClientes($objCliente);
        if (!empty($arrCliente[0]['cod_modelo'])) {
            $objModelo->set_cod_modelo($arrCliente[0]['cod_modelo']);
            $arrModelo = $objModelo->buscaModelos($objModelo);
            $des_modelo = $arrModelo[0]['des_modelo'];
        } else {
            $des_modelo = 'Nao cadastrado';
        }
        $des_modelo = remove_acentuacao($des_modelo);
        $pdf->SetFont('times', 'B', 8);
        $pdf->Write($h = 0, $nom_prestador, $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        $pdf->SetFont('times', 'B', 10);
        $conteudo_cabecalho = sprintf("%s \r\nTelefone: %s\r\n\r\n", $end_prestador, $tel_prestador);
        $conteudo_cabecalho = iconv('UTF-8', 'IBM850', $conteudo_cabecalho);
        $pdf->Write($h = 0, $conteudo_cabecalho, $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        $style = array('position' => 'L', 'border' => false, 'padding' => 5, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => false, 'font' => 'helvetica', 'fontsize' => 3, 'stretchtext' => 2);
        $pdf->write1DBarcode($cod_cartao, 'C128', '', '', 60, 18, 0.4, $style, 'N');
        //$pdf->write1DBarcode($cod_cartao, 'C128A','','',60,18,0.4,$style,'N');
        //$pdf->write1DBarcode($cod_cartao, 'C128B','','',60,18,0.4,$style,'N');
        //$pdf->write1DBarcode($cod_cartao, 'C128C','','',60,18,0.4,$style,'N');
        //$pdf->write1DBarcode($cod_cartao, 'C128B', '', '', 5, 5, 0.4, $style, 'N');
        $cod_cartao = iconv('UTF-8', 'IBM850', $cod_cartao);
        $pdf->Write($h = 0, 'Cartao: ' . $cod_cartao, $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        $pdf->SetFont('times', 'B', 12);
        $pdf->Write($h = 0, "Dia: {$dat_entrada} \r\nHorario: {$hora_entrada}", $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        $conteudo_rodape = sprintf("\r\nVeiculo: %s\r\nPlaca: %s\r\n%s\r\n", $des_modelo, $des_placa, $horario_atendimento);
        $pdf->SetFont('times', 'B', 12);
        $conteudo_rodape = iconv('UTF-8', 'IBM850', $conteudo_rodape);
        $pdf->Write($h = 0, $conteudo_rodape, $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        $pdf->SetFont('times', 'B', 10);
        $multa = iconv('UTF-8', 'IBM850', $multa);
        $pdf->Write($h = 0, $multa, $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        // write some JavaScript code
        $js = <<<EOD
\t\t\t\tthis.print({bUI: true, bSilent: false, bShrinkToFit: true}); 
EOD;
        // set javascript
        $pdf->IncludeJS($js);
        //$arquivo_cartao = $pdf->Output('CupomEntrada-'.$cod_cartao,"S");
        //var_dump(file_put_contents($path_relative.'cupons/CupomEntrada-'.$cod_cartao, $arquivo_cartao));
        //$arquivo = $path_relative.'cuponsEntrada/CupomEntrada-' . $cod_cartao.'.pdf';
        //$pdf->Output($path_relative.'cuponsEntrada/CupomEntrada-' . $cod_cartao.'.pdf',"F");
        $pdf->Output($path_relative . 'cuponsEntrada/CupomEntrada-' . $cod_cartao . '.pdf', "I");
        //$pdf->Output('CupomEntrada-' . $cod_cartao.'.pdf','I');
        //$comando = "C:\Sumatra\SumatraPDF.exe -print-to \"MP-2500 TH\" ".$arquivo;
        //exec($comando);
    }
开发者ID:blusol,项目名称:flanelasys,代码行数:76,代码来源:fla_rotatividade.class.php

示例11: array

$pdf->ComboBox('gender', 10, 5, array('', 'M', 'F'), array('strokeColor' => 'ltGray'));
$pdf->Ln(6);
//Drink
$pdf->Cell(35, 5, 'Drink:');
$pdf->RadioButton('drink', 5, false);
$pdf->Cell(35, 5, 'Water');
$pdf->Ln(6);
$pdf->Cell(35, 5, '');
$pdf->RadioButton('drink', 5, false);
$pdf->Cell(35, 5, 'Beer');
$pdf->Ln(6);
$pdf->Cell(35, 5, '');
$pdf->RadioButton('drink', 5, false);
$pdf->Cell(35, 5, 'Wine');
// set export values
$pdf->IncludeJS('fdrink.exportValues=["Water", "Beer", "Wine"];' . "\n");
// check the second radiobutton
$pdf->IncludeJS("fdrink.checkThisBox(1,true);\n");
$pdf->Ln(10);
//Gender
$pdf->Cell(35, 5, 'List:');
$pdf->ListBox('listbox', 60, 15, array('', 'item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7'), array('multipleSelection' => 'true'));
$pdf->Ln(20);
//Adress
$pdf->Cell(35, 5, 'Address:');
$pdf->TextField('address', 60, 18, array('multiline' => true, 'strokeColor' => 'ltGray'));
$pdf->Ln(19);
//E-mail
$pdf->Cell(35, 5, 'E-mail:');
$pdf->TextField('email', 50, 5, array('strokeColor' => 'ltGray'));
$pdf->Ln(6);
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:31,代码来源:example_014.php

示例12: printpackagingslip


//.........这里部分代码省略.........
<td class="leftside leftheading"><h1>CUSTOMS DECLARATION</h1>
Great Britain
</td>
<td class="rightside rightheading"><h1>CN 22</h1>
May be opened officially
</td>
</tr>
</table>


<div class="fullwidth"><h2>Important!</h2></div>
<div class="producttype">
<table>
<tr>
<td><div>&nbsp;</div>Gift</td>
<td><div>&nbsp;</div>Documents</td>
<td><div>&nbsp;</div>Commercial</td>
<td><div>X</div>Merchandise</td>
</tr>
</table>

</div>
<table class="" border="1" cellpadding="5px" cellspacing="0">
<tr>
<th class="noleftborder" width="60%">Quantity and detailed description of contents</th>
<th valign="top" class="center" width="20%">Weight (kg)</th>
<th valign="top" class="center norightborder" width="20%">Value</th>
</tr>
<tr>
<td class="noleftborder">4 x Health & Nutritional Products</td>
<td valign="top" class="center">175.00</td>
<td valign="top" class="center norightborder">£79.99</td>
</tr>
<tr>
<td class="noleftborder">2 x Baby & Children\'s Health</td>
<td valign="top" class="center">75.00</td>
<td valign="top" class="center norightborder">£29.99</td>
</tr>
<tr>
<td valign="top" class="noleftborder"></td>
<td valign="top " ><table>
<tr><td class="center">P & P<br>VAT</td></tr>
</table></td>
<td valign="top " class="norightborder"><table>
<tr><td class="center">£4.99<br>£17.00</td></tr>
</table></td>
</tr>
<tr>
<td valign="top" height="100%" class="noleftborder"><table height="100%">
<tr><td><span class="bold">For commercial items only</span><br>If known, HS tariff number and country of origin of goods</td></tr>
<tr><td class="center">876534</td></tr>
</table></td>
<td valign="top" height="100%"><table height="100%">
<tr><td class="center bold">Total Weight (kg)</td></tr>
<tr><td class="center">175.00</td></tr>
</table></td>
<td valign="top" height="100%"  class="norightborder"><table height="100%">
<tr><td class="center bold">Total Value</td></tr>
<tr><td class="center">£101.98</td></tr>
</table></td>
</tr>
</table>
<div class="fullwidth"><p>I the undersigned, whose name and address are given on the item, certify that the particulars given in this declaration are correct and that this item does not contain any dangerous article or articles prohibited by legislation or by postal or customs regulations.</p>
<div class="date bold">Date: 22 Sep. 2015</div>
<div class="sign right"></div>
</div>
</div>
<div class="footer row">

<table>
<tr>
<td class="leftside leftheading address"><h3>SHIP TO:</h3>
<span class="bold">Mr Test Customer</span><br>
Address Line 1 Address Line 2 <br>
Some Town Some Region<br>
123 ABC<br>
United Country<br>
</td>
<td class="rightside rightheading leftborder">
<div class="tracking bottomborder"><h3>TRACKING #:</h3>
1Z A90 26X 03 9015 6318
</div>
<div class="barcode center">Purchase Order<div>4584327-0</div>4584327-0</div>
</td>
</tr>
</table>
</div>
<div class="footer row"><span class="bold">If undelivered please return to:</span> Unit 4, Cargo Centre, Jersey Airport, L’Avenue de la Commune, St Peter, JE3 7BY</div>

</div>
</div>

</body>';
        //$html .= '<style>'.file_get_contents($imgPath.'packing.css').'</style>';
        //echo $html;
        $pdf->writeHTML($html, true, false, true, false, '');
        $js = 'print(true);';
        $pdf->IncludeJS($js);
        $pdf->Output('Service_' . $date . '.pdf', 'D');
    }
开发者ID:agashish,项目名称:test_new,代码行数:101,代码来源:del_CronjobsController.php

示例13: TCPDF

<?php

// create new PDF document
include_once 'tcpdf/tcpdf.php';
// new object
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->IncludeJS('rapportEcophile.js');
// set document information
$pdf->SetCreator('TCPDF');
$pdf->SetAuthor('ERDF');
$pdf->SetTitle('Suivi de consommation');
$pdf->SetSubject('Suivi de consommation');
// set default header data
$pdf->SetHeaderData('linky.jpg', 30, 'Suivi de consommation', "Recapitulatif\nwww.erdf.fr", array(2, 64, 128));
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(10);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
    require_once dirname(__FILE__) . '/lang/eng.php';
    $pdf->setLanguageArray($l);
开发者ID:achNorsys,项目名称:linkyErdf,代码行数:31,代码来源:rapportEcophile.php


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