Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //============================================================+
- // File name : example_006.php
- // Begin : 2008-03-04
- // Last Update : 2013-05-14
- //
- // Description : Example 006 for TCPDF class
- // WriteHTML and RTL support
- //
- // Author: Nicola Asuni
- //
- // (c) Copyright:
- // Nicola Asuni
- // Tecnick.com LTD
- // www.tecnick.com
- // info@tecnick.com
- //============================================================+
- /**
- * Creates an example PDF TEST document using TCPDF
- * @package com.tecnick.tcpdf
- * @abstract TCPDF - Example: WriteHTML and RTL support
- * @author Nicola Asuni
- * @since 2008-03-04
- */
- // Include the main TCPDF library (search for installation path).
- require_once('tcpdf.php');
- class MYPDF extends TCPDF {
- public function Header() {
- // Logo
- $image_file = K_PATH_IMAGES.'logo_example.jpg';
- $this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, 'R', false, false, 0, false, false, false);
- // Set font
- $this->SetFont('helvetica', 'B', 20);
- // Title
- }
- public function Footer() {
- // Position at 15 mm from bottom
- $this->SetY(-15);
- // Set font
- $this->SetFont('helvetica', 'r', 7);
- // Page number
- $html = '<hr>';
- // output the HTML content
- $this->writeHTML($html, true, false, true, false, '');
- $this->Cell(0, 0, 'lstdecalr', 0, false, 'R', 0, '', 0, false, 'T', 'M');
- }
- }
- // create new PDF document
- $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
- $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->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)
- if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
- require_once(dirname(__FILE__).'/lang/eng.php');
- $pdf->setLanguageArray($l);
- }
- // ---------------------------------------------------------
- // set font
- $pdf->SetFont('dejavusans', '', 10);
- // add a page
- $pdf->AddPage();
- $html = '<br><hr>';
- $left_column = '<font size="15" face="Verdana"><b>Universidade de Brasilia</b><br>
- <b><font size="13" face="Verdana">Comprovante de Matrícula 2016/2</b><br></font>
- <b><font size="5">Validade: 2016/2</b><br></font>
- <br><font size="11"><b>Curso</b><br>
- Pedagogia<br>
- <b>Nome do Aluno</b><br>
- Evelyn Luíza Dias Figuereido<br>
- <b>Matrícula</b><br>
- 14/0138081<br></font>';
- $right_column = '<br><br>
- <b><font size="6">*** VÁLIDO SOMENTE COM CARIMBO NO VERSO ***</b><br>
- <b><font size="6">*** E APRESENTAÇÃO DA IDENTIDADE ESTUDANTIL ***</b><br></font>';
- $right_column1 ='
- <font size="11"><b>Turno</b><br>
- Diurno<br></font>';
- $y = $pdf->getY();
- $pdf->SetFont('times', '', 8);
- $pdf->SetFillColor(255, 255, 255);
- $pdf->SetTextColor(0, 0, 0);
- $pdf->writeHTMLCell(80, '', '', $y, $left_column, 0, 0, 0, true, 'L', true);
- $html = '<br>';
- // output the HTML content
- $pdf->writeHTML($html, false, false,TRUE, false);
- $pdf->writeHTMLCell(90, 20, 20,38, $right_column, 0, 0, 0, true, 'R', true);
- $pdf->writeHTMLCell(90, 20, 10,73, $right_column1, 0, 0, 0, true, 'R', true);
- $pdf->writeHTMLCell(100, 30, 13, 26, '', 1, 1, 1, true, 'B', true);
- $pdf->writeHTMLCell(100, 50, 13, 49, '', 1, 1, 1, true, 'B', true);
- $pdf->writeHTMLCell(98, 32, 14, 50, '', 1, 1, 1, true, 'B', true);
- // CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
- // define barcode style
- // create some HTML content
- $image_file = K_PATH_IMAGES.'12.png';
- $pdf->Image($image_file, 50, 86, 50,'', 'PNG', 6, 'B', false, 65,300, false, false, 0, false, false, false);
- // output some RTL HTML content
- // test some inline CSS
- // ---------------------------------------------------------
- //Close and output PDF document
- $pdf->Output('example_006.pdf', 'I');
- //============================================================+
- // END OF FILE
- //============================================================+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement