Subversion Repositories Applications.annuaire

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
296 aurelien 1
<?php
2
//============================================================+
3
// File name   : example_037.php
4
// Begin       : 2008-09-12
5
// Last Update : 2010-08-08
6
//
7
// Description : Example 037 for TCPDF class
8
//               Spot colors
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: Spot colors.
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-09-12
31
 */
32
 
33
require_once('../config/lang/eng.php');
34
require_once('../tcpdf.php');
35
 
36
// create new PDF document
37
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
38
 
39
// set document information
40
$pdf->SetCreator(PDF_CREATOR);
41
$pdf->SetAuthor('Nicola Asuni');
42
$pdf->SetTitle('TCPDF Example 037');
43
$pdf->SetSubject('TCPDF Tutorial');
44
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
45
 
46
// set default header data
47
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 037', PDF_HEADER_STRING);
48
 
49
// set header and footer fonts
50
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
51
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
52
 
53
// set default monospaced font
54
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
55
 
56
//set margins
57
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
58
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
59
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
60
 
61
//set auto page breaks
62
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
63
 
64
//set image scale factor
65
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
66
 
67
//set some language-dependent strings
68
$pdf->setLanguageArray($l);
69
 
70
// ---------------------------------------------------------
71
 
72
// set font
73
$pdf->SetFont('helvetica', '', 20);
74
 
75
// add a page
76
$pdf->AddPage();
77
 
78
 
79
$pdf->Write(0, 'Example of Spot Colors', '', 0, 'L', true, 0, false, false, 0);
80
 
81
$pdf->Ln(5);
82
 
83
$pdf->SetFont('helvetica', '', 8);
84
 
85
// Define some new spot colors
86
// $c, $m, $y and $k (2nd, 3rd, 4th and 5th parameter) are the CMYK color components.
87
// AddSpotColor($name, $c, $m, $y, $k)
88
$pdf->AddSpotColor('Pantone 116 C', 0, 20, 100, 0);
89
$pdf->AddSpotColor('HKS 16 K', 30, 100, 90, 10);
90
$pdf->AddSpotColor('Pantone 505 C', 57, 100, 85, 55);
91
$pdf->AddSpotColor('Pantone 440 C', 50, 60, 80, 70);
92
$pdf->AddSpotColor('Pantone 288 C', 100, 60, 10, 5);
93
$pdf->AddSpotColor('Pantone 289 C', 100, 78, 50, 0);
94
$pdf->AddSpotColor('Pantone 356 C', 100, 30, 100, 0);
95
$pdf->AddSpotColor('Pantone 567 C', 100, 50, 80, 45);
96
$pdf->AddSpotColor('Pantone 9060 C', 0, 0, 7, 0);
97
$pdf->AddSpotColor('Pantone 420 C', 22, 14, 22, 0);
98
$pdf->AddSpotColor('Pantone 422 C', 39, 24, 34, 0);
99
$pdf->AddSpotColor('Pantone 433 C', 34, 0, 0, 94);
100
$pdf->AddSpotColor('NovaSpace-Black', 50, 0, 0, 100);
101
$pdf->AddSpotColor('Pantone 601 C', 0, 0, 55, 0);
102
$pdf->AddSpotColor('Pantone 659 C', 50, 20, 0, 10);
103
 
104
// Select the spot color
105
// $tint (the second parameter) is the intensity of the color (0-100).
106
// SetTextSpotColor($name, $tint=100)
107
// SetDrawSpotColor($name, $tint=100)
108
// SetFillSpotColor($name, $tint=100)
109
 
110
$pdf->SetTextSpotColor('NovaSpace-Black', 100);
111
$pdf->SetDrawSpotColor('NovaSpace-Black', 100);
112
 
113
$starty = 50;
114
 
115
// print some spot colors
116
$pdf->SetFillSpotColor('Pantone 116 C', 100);
117
$pdf->Rect(30, $starty, 20, 6, 'DF');
118
$pdf->Text(53, $starty + 1, 'Pantone 116 C');
119
 
120
$starty += 8;
121
 
122
$pdf->SetFillSpotColor('HKS 16 K', 100);
123
$pdf->Rect(30, $starty, 20, 6, 'DF');
124
$pdf->Text(53, $starty + 1, 'HKS 16 K');
125
 
126
$starty += 8;
127
 
128
$pdf->SetFillSpotColor('Pantone 505 C', 100);
129
$pdf->Rect(30, $starty, 20, 6, 'DF');
130
$pdf->Text(53, $starty + 1, 'Pantone 505 C');
131
 
132
$starty += 8;
133
 
134
$pdf->SetFillSpotColor('Pantone 440 C', 100);
135
$pdf->Rect(30, $starty, 20, 6, 'DF');
136
$pdf->Text(53, $starty + 1, 'Pantone 440 C');
137
 
138
$starty += 8;
139
 
140
$pdf->SetFillSpotColor('Pantone 288 C', 100);
141
$pdf->Rect(30, $starty, 20, 6, 'DF');
142
$pdf->Text(53, $starty + 1, 'Pantone 288 C');
143
 
144
$starty += 8;
145
 
146
$pdf->SetFillSpotColor('Pantone 289 C', 100);
147
$pdf->Rect(30, $starty, 20, 6, 'DF');
148
$pdf->Text(53, $starty + 1, 'Pantone 289 C');
149
 
150
$starty += 8;
151
 
152
$pdf->SetFillSpotColor('Pantone 356 C', 100);
153
$pdf->Rect(30, $starty, 20, 6, 'DF');
154
$pdf->Text(53, $starty + 1, 'Pantone 356 C');
155
 
156
$starty += 8;
157
 
158
$pdf->SetFillSpotColor('Pantone 567 C', 100);
159
$pdf->Rect(30, $starty, 20, 6, 'DF');
160
$pdf->Text(53, $starty + 1, 'Pantone 567 C');
161
 
162
$starty += 8;
163
 
164
$pdf->SetFillSpotColor('Pantone 9060 C', 100);
165
$pdf->Rect(30, $starty, 20, 6, 'DF');
166
$pdf->Text(53, $starty + 1, 'Pantone 9060 C');
167
 
168
$starty += 8;
169
 
170
$pdf->SetFillSpotColor('Pantone 420 C', 100);
171
$pdf->Rect(30, $starty, 20, 6, 'DF');
172
$pdf->Text(53, $starty + 1, 'Pantone 420 C');
173
 
174
$starty += 8;
175
 
176
$pdf->SetFillSpotColor('Pantone 422 C', 100);
177
$pdf->Rect(30, $starty, 20, 6, 'DF');
178
$pdf->Text(53, $starty + 1, 'Pantone 422 C');
179
 
180
$starty += 8;
181
 
182
$pdf->SetFillSpotColor('Pantone 433 C', 100);
183
$pdf->Rect(30, $starty, 20, 6, 'DF');
184
$pdf->Text(53, $starty + 1, 'Pantone 433 C');
185
 
186
$starty += 8;
187
 
188
$pdf->SetFillSpotColor('Pantone 601 C', 100);
189
$pdf->Rect(30, $starty, 20, 6, 'DF');
190
$pdf->Text(53, $starty + 1, 'Pantone 601 C');
191
 
192
$starty += 8;
193
 
194
$pdf->SetFillSpotColor('Pantone 659 C', 100);
195
$pdf->Rect(30, $starty, 20, 6, 'DF');
196
$pdf->Text(53, $starty + 1, 'Pantone 659 C');
197
 
198
// ---------------------------------------------------------
199
 
200
//Close and output PDF document
201
$pdf->Output('example_037.pdf', 'I');
202
 
203
//============================================================+
204
// END OF FILE
205
//============================================================+