1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
require_once('tcpdf_include.php');
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
$pdf->SetCreator(PDF_CREATOR);
|
35 |
|
|
$pdf->SetAuthor('Nicola Asuni');
|
36 |
|
|
$pdf->SetTitle('TCPDF Example 027');
|
37 |
|
|
$pdf->SetSubject('TCPDF Tutorial');
|
38 |
|
|
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 027', PDF_HEADER_STRING);
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
|
45 |
|
|
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
|
52 |
|
|
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
|
53 |
|
|
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
|
63 |
|
|
require_once(dirname(__FILE__).'/lang/eng.php');
|
64 |
|
|
$pdf->setLanguageArray($l);
|
65 |
|
|
}
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
$pdf->setBarcode(date('Y-m-d H:i:s'));
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
$pdf->SetFont('helvetica', '', 11);
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
$pdf->AddPage();
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
$txt = "You can also export 1D barcodes in other formats (PNG, SVG, HTML). Check the examples inside the barcodes directory.\n";
|
80 |
|
|
$pdf->MultiCell(70, 50, $txt, 0, 'J', false, 1, 125, 30, true, 0, false, true, 0, 'T', false);
|
81 |
|
|
$pdf->SetY(30);
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
$pdf->SetFont('helvetica', '', 10);
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
$style = array(
|
89 |
|
|
'position' => '',
|
90 |
|
|
'align' => 'C',
|
91 |
|
|
'stretch' => false,
|
92 |
|
|
'fitwidth' => true,
|
93 |
|
|
'cellfitalign' => '',
|
94 |
|
|
'border' => true,
|
95 |
|
|
'hpadding' => 'auto',
|
96 |
|
|
'vpadding' => 'auto',
|
97 |
|
|
'fgcolor' => array(0,0,0),
|
98 |
|
|
'bgcolor' => false,
|
99 |
|
|
'text' => true,
|
100 |
|
|
'font' => 'helvetica',
|
101 |
|
|
'fontsize' => 8,
|
102 |
|
|
'stretchtext' => 4
|
103 |
|
|
);
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
$pdf->Cell(0, 0, 'CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9', 0, 1);
|
109 |
|
|
$pdf->write1DBarcode('CODE 39', 'C39', '', '', '', 18, 0.4, $style, 'N');
|
110 |
|
|
|
111 |
|
|
$pdf->Ln();
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
$pdf->Cell(0, 0, 'CODE 39 + CHECKSUM', 0, 1);
|
115 |
|
|
$pdf->write1DBarcode('CODE 39 +', 'C39+', '', '', '', 18, 0.4, $style, 'N');
|
116 |
|
|
|
117 |
|
|
$pdf->Ln();
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
$pdf->Cell(0, 0, 'CODE 39 EXTENDED', 0, 1);
|
121 |
|
|
$pdf->write1DBarcode('CODE 39 E', 'C39E', '', '', '', 18, 0.4, $style, 'N');
|
122 |
|
|
|
123 |
|
|
$pdf->Ln();
|
124 |
|
|
|
125 |
|
|
|
126 |
|
|
$pdf->Cell(0, 0, 'CODE 39 EXTENDED + CHECKSUM', 0, 1);
|
127 |
|
|
$pdf->write1DBarcode('CODE 39 E+', 'C39E+', '', '', '', 18, 0.4, $style, 'N');
|
128 |
|
|
|
129 |
|
|
$pdf->Ln();
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
$pdf->Cell(0, 0, 'CODE 93 - USS-93', 0, 1);
|
133 |
|
|
$pdf->write1DBarcode('TEST93', 'C93', '', '', '', 18, 0.4, $style, 'N');
|
134 |
|
|
|
135 |
|
|
$pdf->Ln();
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
$pdf->Cell(0, 0, 'Standard 2 of 5', 0, 1);
|
139 |
|
|
$pdf->write1DBarcode('1234567', 'S25', '', '', '', 18, 0.4, $style, 'N');
|
140 |
|
|
|
141 |
|
|
$pdf->Ln();
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
$pdf->Cell(0, 0, 'Standard 2 of 5 + CHECKSUM', 0, 1);
|
145 |
|
|
$pdf->write1DBarcode('1234567', 'S25+', '', '', '', 18, 0.4, $style, 'N');
|
146 |
|
|
|
147 |
|
|
$pdf->Ln();
|
148 |
|
|
|
149 |
|
|
|
150 |
|
|
$pdf->Cell(0, 0, 'Interleaved 2 of 5', 0, 1);
|
151 |
|
|
$pdf->write1DBarcode('1234567', 'I25', '', '', '', 18, 0.4, $style, 'N');
|
152 |
|
|
|
153 |
|
|
$pdf->Ln();
|
154 |
|
|
|
155 |
|
|
|
156 |
|
|
$pdf->Cell(0, 0, 'Interleaved 2 of 5 + CHECKSUM', 0, 1);
|
157 |
|
|
$pdf->write1DBarcode('1234567', 'I25+', '', '', '', 18, 0.4, $style, 'N');
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
|
|
$pdf->AddPage();
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
$pdf->Cell(0, 0, 'CODE 128 AUTO', 0, 1);
|
165 |
|
|
$pdf->write1DBarcode('CODE 128 AUTO', 'C128', '', '', '', 18, 0.4, $style, 'N');
|
166 |
|
|
|
167 |
|
|
$pdf->Ln();
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
$pdf->Cell(0, 0, 'CODE 128 A', 0, 1);
|
171 |
|
|
$pdf->write1DBarcode('CODE 128 A', 'C128A', '', '', '', 18, 0.4, $style, 'N');
|
172 |
|
|
|
173 |
|
|
$pdf->Ln();
|
174 |
|
|
|
175 |
|
|
|
176 |
|
|
$pdf->Cell(0, 0, 'CODE 128 B', 0, 1);
|
177 |
|
|
$pdf->write1DBarcode('CODE 128 B', 'C128B', '', '', '', 18, 0.4, $style, 'N');
|
178 |
|
|
|
179 |
|
|
$pdf->Ln();
|
180 |
|
|
|
181 |
|
|
|
182 |
|
|
$pdf->Cell(0, 0, 'CODE 128 C', 0, 1);
|
183 |
|
|
$pdf->write1DBarcode('0123456789', 'C128C', '', '', '', 18, 0.4, $style, 'N');
|
184 |
|
|
|
185 |
|
|
$pdf->Ln();
|
186 |
|
|
|
187 |
|
|
|
188 |
|
|
$pdf->Cell(0, 0, 'EAN 8', 0, 1);
|
189 |
|
|
$pdf->write1DBarcode('1234567', 'EAN8', '', '', '', 18, 0.4, $style, 'N');
|
190 |
|
|
|
191 |
|
|
$pdf->Ln();
|
192 |
|
|
|
193 |
|
|
|
194 |
|
|
$pdf->Cell(0, 0, 'EAN 13', 0, 1);
|
195 |
|
|
$pdf->write1DBarcode('1234567890128', 'EAN13', '', '', '', 18, 0.4, $style, 'N');
|
196 |
|
|
|
197 |
|
|
$pdf->Ln();
|
198 |
|
|
|
199 |
|
|
|
200 |
|
|
$pdf->Cell(0, 0, 'UPC-A', 0, 1);
|
201 |
|
|
$pdf->write1DBarcode('12345678901', 'UPCA', '', '', '', 18, 0.4, $style, 'N');
|
202 |
|
|
|
203 |
|
|
$pdf->Ln();
|
204 |
|
|
|
205 |
|
|
|
206 |
|
|
$pdf->Cell(0, 0, 'UPC-E', 0, 1);
|
207 |
|
|
$pdf->write1DBarcode('04210000526', 'UPCE', '', '', '', 18, 0.4, $style, 'N');
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
$pdf->AddPage();
|
211 |
|
|
|
212 |
c3ebc5b9
|
Assos Assos
|
|
213 |
|
|
$pdf->Cell(0, 0, '5-Digits UPC-Based Extension', 0, 1);
|
214 |
85ad3d82
|
Assos Assos
|
$pdf->write1DBarcode('51234', 'EAN5', '', '', '', 18, 0.4, $style, 'N');
|
215 |
|
|
|
216 |
|
|
$pdf->Ln();
|
217 |
|
|
|
218 |
c3ebc5b9
|
Assos Assos
|
|
219 |
|
|
$pdf->Cell(0, 0, '2-Digits UPC-Based Extension', 0, 1);
|
220 |
85ad3d82
|
Assos Assos
|
$pdf->write1DBarcode('34', 'EAN2', '', '', '', 18, 0.4, $style, 'N');
|
221 |
|
|
|
222 |
|
|
$pdf->Ln();
|
223 |
|
|
|
224 |
|
|
|
225 |
|
|
$pdf->Cell(0, 0, 'MSI', 0, 1);
|
226 |
|
|
$pdf->write1DBarcode('80523', 'MSI', '', '', '', 18, 0.4, $style, 'N');
|
227 |
|
|
|
228 |
|
|
$pdf->Ln();
|
229 |
|
|
|
230 |
|
|
|
231 |
|
|
$pdf->Cell(0, 0, 'MSI + CHECKSUM (module 11)', 0, 1);
|
232 |
|
|
$pdf->write1DBarcode('80523', 'MSI+', '', '', '', 18, 0.4, $style, 'N');
|
233 |
|
|
|
234 |
|
|
$pdf->Ln();
|
235 |
|
|
|
236 |
|
|
|
237 |
|
|
$pdf->Cell(0, 0, 'CODABAR', 0, 1);
|
238 |
|
|
$pdf->write1DBarcode('123456789', 'CODABAR', '', '', '', 18, 0.4, $style, 'N');
|
239 |
|
|
|
240 |
|
|
$pdf->Ln();
|
241 |
|
|
|
242 |
|
|
|
243 |
|
|
$pdf->Cell(0, 0, 'CODE 11', 0, 1);
|
244 |
|
|
$pdf->write1DBarcode('123-456-789', 'CODE11', '', '', '', 18, 0.4, $style, 'N');
|
245 |
|
|
|
246 |
|
|
$pdf->Ln();
|
247 |
|
|
|
248 |
|
|
|
249 |
|
|
$pdf->Cell(0, 0, 'PHARMACODE', 0, 1);
|
250 |
|
|
$pdf->write1DBarcode('789', 'PHARMA', '', '', '', 18, 0.4, $style, 'N');
|
251 |
|
|
|
252 |
|
|
$pdf->Ln();
|
253 |
|
|
|
254 |
|
|
|
255 |
|
|
$pdf->Cell(0, 0, 'PHARMACODE TWO-TRACKS', 0, 1);
|
256 |
|
|
$pdf->write1DBarcode('105', 'PHARMA2T', '', '', '', 18, 2, $style, 'N');
|
257 |
|
|
|
258 |
|
|
|
259 |
|
|
$pdf->AddPage();
|
260 |
|
|
|
261 |
|
|
|
262 |
|
|
$pdf->Cell(0, 0, 'IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200', 0, 1);
|
263 |
|
|
$pdf->write1DBarcode('01234567094987654321-01234567891', 'IMB', '', '', '', 15, 0.6, $style, 'N');
|
264 |
|
|
|
265 |
|
|
$pdf->Ln();
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
$pdf->Cell(0, 0, 'POSTNET', 0, 1);
|
269 |
|
|
$pdf->write1DBarcode('98000', 'POSTNET', '', '', '', 15, 0.6, $style, 'N');
|
270 |
|
|
|
271 |
|
|
$pdf->Ln();
|
272 |
|
|
|
273 |
|
|
|
274 |
|
|
$pdf->Cell(0, 0, 'PLANET', 0, 1);
|
275 |
|
|
$pdf->write1DBarcode('98000', 'PLANET', '', '', '', 15, 0.6, $style, 'N');
|
276 |
|
|
|
277 |
|
|
$pdf->Ln();
|
278 |
|
|
|
279 |
|
|
|
280 |
|
|
$pdf->Cell(0, 0, 'RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)', 0, 1);
|
281 |
|
|
$pdf->write1DBarcode('SN34RD1A', 'RMS4CC', '', '', '', 15, 0.6, $style, 'N');
|
282 |
|
|
|
283 |
|
|
$pdf->Ln();
|
284 |
|
|
|
285 |
|
|
|
286 |
|
|
$pdf->Cell(0, 0, 'KIX (Klant index - Customer index)', 0, 1);
|
287 |
|
|
$pdf->write1DBarcode('SN34RDX1A', 'KIX', '', '', '', 15, 0.6, $style, 'N');
|
288 |
|
|
|
289 |
|
|
|
290 |
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
|
|
$pdf->AddPage();
|
294 |
|
|
|
295 |
|
|
|
296 |
|
|
$style['bgcolor'] = array(255,255,240);
|
297 |
|
|
$style['fgcolor'] = array(127,0,0);
|
298 |
|
|
|
299 |
|
|
|
300 |
|
|
$style['position'] = 'L';
|
301 |
|
|
$pdf->write1DBarcode('LEFT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
|
302 |
|
|
|
303 |
|
|
$pdf->Ln(2);
|
304 |
|
|
|
305 |
|
|
|
306 |
|
|
$style['position'] = 'C';
|
307 |
|
|
$pdf->write1DBarcode('CENTER', 'C128A', '', '', '', 15, 0.4, $style, 'N');
|
308 |
|
|
|
309 |
|
|
$pdf->Ln(2);
|
310 |
|
|
|
311 |
|
|
|
312 |
|
|
$style['position'] = 'R';
|
313 |
|
|
$pdf->write1DBarcode('RIGHT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
|
314 |
|
|
|
315 |
|
|
$pdf->Ln(2);
|
316 |
|
|
|
317 |
|
|
|
318 |
|
|
$style['fgcolor'] = array(0,127,0);
|
319 |
|
|
$style['position'] = '';
|
320 |
|
|
$style['stretch'] = false;
|
321 |
|
|
$style['fitwidth'] = false;
|
322 |
|
|
|
323 |
|
|
|
324 |
|
|
$style['align'] = 'L';
|
325 |
|
|
$pdf->write1DBarcode('LEFT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
|
326 |
|
|
|
327 |
|
|
$pdf->Ln(2);
|
328 |
|
|
|
329 |
|
|
|
330 |
|
|
$style['align'] = 'C';
|
331 |
|
|
$pdf->write1DBarcode('CENTER', 'C128A', '', '', '', 15, 0.4, $style, 'N');
|
332 |
|
|
|
333 |
|
|
$pdf->Ln(2);
|
334 |
|
|
|
335 |
|
|
|
336 |
|
|
$style['align'] = 'R';
|
337 |
|
|
$pdf->write1DBarcode('RIGHT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
|
338 |
|
|
|
339 |
|
|
$pdf->Ln(2);
|
340 |
|
|
|
341 |
|
|
|
342 |
|
|
$style['fgcolor'] = array(0,64,127);
|
343 |
|
|
$style['position'] = '';
|
344 |
|
|
$style['stretch'] = false;
|
345 |
|
|
$style['fitwidth'] = true;
|
346 |
|
|
|
347 |
|
|
|
348 |
|
|
$style['cellfitalign'] = 'L';
|
349 |
|
|
$pdf->write1DBarcode('LEFT', 'C128A', 105, '', 90, 15, 0.4, $style, 'N');
|
350 |
|
|
|
351 |
|
|
$pdf->Ln(2);
|
352 |
|
|
|
353 |
|
|
|
354 |
|
|
$style['cellfitalign'] = 'C';
|
355 |
|
|
$pdf->write1DBarcode('CENTER', 'C128A', 105, '', 90, 15, 0.4, $style, 'N');
|
356 |
|
|
|
357 |
|
|
$pdf->Ln(2);
|
358 |
|
|
|
359 |
|
|
|
360 |
|
|
$style['cellfitalign'] = 'R';
|
361 |
|
|
$pdf->write1DBarcode('RIGHT', 'C128A', 105, '', 90, 15, 0.4, $style, 'N');
|
362 |
|
|
|
363 |
|
|
$pdf->Ln(2);
|
364 |
|
|
|
365 |
|
|
|
366 |
|
|
$style['fgcolor'] = array(127,0,127);
|
367 |
|
|
|
368 |
|
|
|
369 |
|
|
$style['position'] = 'L';
|
370 |
|
|
$pdf->write1DBarcode('LEFT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
|
371 |
|
|
|
372 |
|
|
$pdf->Ln(2);
|
373 |
|
|
|
374 |
|
|
|
375 |
|
|
$style['position'] = 'C';
|
376 |
|
|
$pdf->write1DBarcode('CENTER', 'C128A', '', '', '', 15, 0.4, $style, 'N');
|
377 |
|
|
|
378 |
|
|
$pdf->Ln(2);
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
$style['position'] = 'R';
|
382 |
|
|
$pdf->write1DBarcode('RIGHT', 'C128A', '', '', '', 15, 0.4, $style, 'N');
|
383 |
|
|
|
384 |
|
|
|
385 |
|
|
|
386 |
|
|
|
387 |
|
|
|
388 |
|
|
$style = array(
|
389 |
|
|
'position' => '',
|
390 |
|
|
'align' => '',
|
391 |
|
|
'stretch' => true,
|
392 |
|
|
'fitwidth' => false,
|
393 |
|
|
'cellfitalign' => '',
|
394 |
|
|
'border' => true,
|
395 |
|
|
'hpadding' => 'auto',
|
396 |
|
|
'vpadding' => 'auto',
|
397 |
|
|
'fgcolor' => array(0,0,128),
|
398 |
|
|
'bgcolor' => array(255,255,128),
|
399 |
|
|
'text' => true,
|
400 |
|
|
'label' => 'CUSTOM LABEL',
|
401 |
|
|
'font' => 'helvetica',
|
402 |
|
|
'fontsize' => 8,
|
403 |
|
|
'stretchtext' => 4
|
404 |
|
|
);
|
405 |
|
|
|
406 |
|
|
|
407 |
|
|
$pdf->Cell(0, 0, 'CODE 39 EXTENDED + CHECKSUM', 0, 1);
|
408 |
|
|
$pdf->SetLineStyle(array('width' => 1, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0)));
|
409 |
|
|
$pdf->write1DBarcode('CODE 39 E+', 'C39E+', '', '', 120, 25, 0.4, $style, 'N');
|
410 |
|
|
|
411 |
|
|
|
412 |
|
|
|
413 |
|
|
|
414 |
|
|
$pdf->Output('example_027.pdf', 'I');
|
415 |
|
|
|
416 |
|
|
|
417 |
|
|
|
418 |
|
|
|