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