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