[347] | 1 | <?php
|
---|
| 2 | //============================================================+
|
---|
| 3 | // File name : example_019.php
|
---|
| 4 | // Begin : 2008-03-07
|
---|
| 5 | // Last Update : 2013-05-14
|
---|
| 6 | //
|
---|
| 7 | // Description : Example 019 for TCPDF class
|
---|
| 8 | // Non unicode with alternative config file
|
---|
| 9 | //
|
---|
| 10 | // Author: Nicola Asuni
|
---|
| 11 | //
|
---|
| 12 | // (c) Copyright:
|
---|
| 13 | // Nicola Asuni
|
---|
| 14 | // Tecnick.com LTD
|
---|
| 15 | // www.tecnick.com
|
---|
| 16 | // info@tecnick.com
|
---|
| 17 | //============================================================+
|
---|
| 18 |
|
---|
| 19 | /**
|
---|
| 20 | * Creates an example PDF TEST document using TCPDF
|
---|
| 21 | * @package com.tecnick.tcpdf
|
---|
| 22 | * @abstract TCPDF - Example: Non unicode with alternative config file
|
---|
| 23 | * @author Nicola Asuni
|
---|
| 24 | * @since 2008-03-04
|
---|
| 25 | */
|
---|
| 26 |
|
---|
| 27 | // Include the main TCPDF library (search for installation path).
|
---|
| 28 | require_once('tcpdf_include.php');
|
---|
| 29 |
|
---|
| 30 | // create new PDF document
|
---|
| 31 | $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, false, 'ISO-8859-1', false);
|
---|
| 32 |
|
---|
| 33 | // Set document information dictionary in unicode mode
|
---|
| 34 | $pdf->SetDocInfoUnicode(true);
|
---|
| 35 |
|
---|
| 36 | // set document information
|
---|
| 37 | $pdf->SetCreator(PDF_CREATOR);
|
---|
| 38 | $pdf->SetAuthor('Nicola Asuni [â¬]');
|
---|
| 39 | $pdf->SetTitle('TCPDF Example 019');
|
---|
| 40 | $pdf->SetSubject('TCPDF Tutorial');
|
---|
| 41 | $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
|
---|
| 42 |
|
---|
| 43 | // set default header data
|
---|
| 44 | $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 019', PDF_HEADER_STRING);
|
---|
| 45 |
|
---|
| 46 | // set header and footer fonts
|
---|
| 47 | $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
|
---|
| 48 | $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
|
---|
| 49 |
|
---|
| 50 | // set default monospaced font
|
---|
| 51 | $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
|
---|
| 52 |
|
---|
| 53 | // set margins
|
---|
| 54 | $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
|
---|
| 55 | $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
|
---|
| 56 | $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
|
---|
| 57 |
|
---|
| 58 | // set auto page breaks
|
---|
| 59 | $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
|
---|
| 60 |
|
---|
| 61 | // set image scale factor
|
---|
| 62 | $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
---|
| 63 |
|
---|
| 64 | // set some language dependent data:
|
---|
| 65 | $lg = Array();
|
---|
| 66 | $lg['a_meta_charset'] = 'ISO-8859-1';
|
---|
| 67 | $lg['a_meta_dir'] = 'ltr';
|
---|
| 68 | $lg['a_meta_language'] = 'en';
|
---|
| 69 | $lg['w_page'] = 'page';
|
---|
| 70 |
|
---|
| 71 | // set some language-dependent strings (optional)
|
---|
| 72 | $pdf->setLanguageArray($lg);
|
---|
| 73 |
|
---|
| 74 | // ---------------------------------------------------------
|
---|
| 75 |
|
---|
| 76 | // set font
|
---|
| 77 | $pdf->SetFont('helvetica', '', 12);
|
---|
| 78 |
|
---|
| 79 | // add a page
|
---|
| 80 | $pdf->AddPage();
|
---|
| 81 |
|
---|
| 82 | // set color for background
|
---|
| 83 | $pdf->SetFillColor(200, 255, 200);
|
---|
| 84 |
|
---|
| 85 | $txt = 'An alternative configuration file is used on this example.
|
---|
| 86 | Check the definition of the K_TCPDF_EXTERNAL_CONFIG constant on the source code.';
|
---|
| 87 |
|
---|
| 88 | // print some text
|
---|
| 89 | $pdf->MultiCell(0, 0, $txt."\n", 1, 'J', 1, 1, '', '', true, 0, false, true, 0);
|
---|
| 90 |
|
---|
| 91 | // ---------------------------------------------------------
|
---|
| 92 |
|
---|
| 93 | //Close and output PDF document
|
---|
| 94 | $pdf->Output('example_019.pdf', 'I');
|
---|
| 95 |
|
---|
| 96 | //============================================================+
|
---|
| 97 | // END OF FILE
|
---|
| 98 | //============================================================+
|
---|