You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* PHP class to creates array representations for 2D barcodes to be used with TCPDF.
38
38
* @package com.tecnick.tcpdf
39
39
* @author Nicola Asuni
40
-
* @version 1.0.007
40
+
* @version 1.0.012
41
41
*/
42
42
43
43
/**
44
44
* @class TCPDF2DBarcode
45
45
* PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www.tcpdf.org).
46
46
* @package com.tecnick.tcpdf
47
-
* @version 1.0.007
47
+
* @version 1.0.012
48
48
* @author Nicola Asuni
49
49
*/
50
50
class TCPDF2DBarcode {
@@ -63,7 +63,7 @@ class TCPDF2DBarcode {
63
63
* <li>$arrcode['num_cols'] required number of columns</li>
64
64
* <li>$arrcode['bcode'][$r][$c] value of the cell is $r row and $c column (0 = transparent, 1 = black)</li></ul>
65
65
* @param $code (string) code to print
66
-
* @param $type (string) type of barcode: <ul><li>RAW: raw mode - comma-separad list of array rows</li><li>RAW2: raw mode - array rows are surrounded by square parenthesis.</li><li>QRCODE : QR-CODE Low error correction</li><li>QRCODE,L : QR-CODE Low error correction</li><li>QRCODE,M : QR-CODE Medium error correction</li><li>QRCODE,Q : QR-CODE Better error correction</li><li>QRCODE,H : QR-CODE Best error correction</li><li>PDF417 : PDF417 (ISO/IEC 15438:2006)</li><li>PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6 : PDF417 with parameters: a = aspect ratio (width/height); e = error correction level (0-8); t = total number of macro segments; s = macro segment index (0-99998); f = file ID; o0 = File Name (text); o1 = Segment Count (numeric); o2 = Time Stamp (numeric); o3 = Sender (text); o4 = Addressee (text); o5 = File Size (numeric); o6 = Checksum (numeric). NOTES: Parameters t, s and f are required for a Macro Control Block, all other parametrs are optional. To use a comma character ',' on text options, replace it with the character 255: "\xff".</li></ul>
66
+
* @param $type (string) type of barcode: <ul><li>DATAMATRIX : Datamatrix (ISO/IEC 16022)</li><li>PDF417 : PDF417 (ISO/IEC 15438:2006)</li><li>PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6 : PDF417 with parameters: a = aspect ratio (width/height); e = error correction level (0-8); t = total number of macro segments; s = macro segment index (0-99998); f = file ID; o0 = File Name (text); o1 = Segment Count (numeric); o2 = Time Stamp (numeric); o3 = Sender (text); o4 = Addressee (text); o5 = File Size (numeric); o6 = Checksum (numeric). NOTES: Parameters t, s and f are required for a Macro Control Block, all other parametrs are optional. To use a comma character ',' on text options, replace it with the character 255: "\xff".</li><li>QRCODE : QRcode Low error correction</li><li>QRCODE,L : QRcode Low error correction</li><li>QRCODE,M : QRcode Medium error correction</li><li>QRCODE,Q : QRcode Better error correction</li><li>QRCODE,H : QR-CODE Best error correction</li><li>RAW: raw mode - comma-separad list of array rows</li><li>RAW2: raw mode - array rows are surrounded by square parenthesis.</li><li>TEST : Test matrix</li></ul>
67
67
*/
68
68
publicfunction__construct($code, $type) {
69
69
$this->setBarcode($code, $type);
@@ -77,23 +77,171 @@ public function getBarcodeArray() {
77
77
return$this->barcode_array;
78
78
}
79
79
80
+
/**
81
+
* Send barcode as SVG image object to the standard output.
82
+
* @param $w (int) Width of a single rectangle element in user units.
83
+
* @param $h (int) Height of a single rectangle element in user units.
84
+
* @param $color (string) Foreground color (in SVG format) for bar elements (background is transparent).
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
220
+
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
221
+
if ($imagick) {
222
+
$png->drawimage($bar);
223
+
echo$png;
224
+
} else {
225
+
imagepng($png);
226
+
imagedestroy($png);
227
+
}
228
+
}
229
+
80
230
/**
81
231
* Set the barcode.
82
232
* @param $code (string) code to print
83
-
* @param $type (string) type of barcode: <ul><li>RAW: raw mode - comma-separad list of array rows</li><li>RAW2: raw mode - array rows are surrounded by square parenthesis.</li><li>QRCODE : QR-CODE Low error correction</li><li>QRCODE,L : QR-CODE Low error correction</li><li>QRCODE,M : QR-CODE Medium error correction</li><li>QRCODE,Q : QR-CODE Better error correction</li><li>QRCODE,H : QR-CODE Best error correction</li><li>PDF417 : PDF417 (ISO/IEC 15438:2006)</li><li>PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6 : PDF417 with parameters: a = aspect ratio (width/height); e = error correction level (0-8); t = total number of macro segments; s = macro segment index (0-99998); f = file ID; o0 = File Name (text); o1 = Segment Count (numeric); o2 = Time Stamp (numeric); o3 = Sender (text); o4 = Addressee (text); o5 = File Size (numeric); o6 = Checksum (numeric). NOTES: Parameters t, s and f are required for a Macro Control Block, all other parametrs are optional. To use a comma character ',' on text options, replace it with the character 255: "\xff".</li></ul>
233
+
* @param $type (string) type of barcode: <ul><li>DATAMATRIX : Datamatrix (ISO/IEC 16022)</li><li>PDF417 : PDF417 (ISO/IEC 15438:2006)</li><li>PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6 : PDF417 with parameters: a = aspect ratio (width/height); e = error correction level (0-8); t = total number of macro segments; s = macro segment index (0-99998); f = file ID; o0 = File Name (text); o1 = Segment Count (numeric); o2 = Time Stamp (numeric); o3 = Sender (text); o4 = Addressee (text); o5 = File Size (numeric); o6 = Checksum (numeric). NOTES: Parameters t, s and f are required for a Macro Control Block, all other parametrs are optional. To use a comma character ',' on text options, replace it with the character 255: "\xff".</li><li>QRCODE : QRcode Low error correction</li><li>QRCODE,L : QRcode Low error correction</li><li>QRCODE,M : QRcode Medium error correction</li><li>QRCODE,Q : QRcode Better error correction</li><li>QRCODE,H : QR-CODE Best error correction</li><li>RAW: raw mode - comma-separad list of array rows</li><li>RAW2: raw mode - array rows are surrounded by square parenthesis.</li><li>TEST : Test matrix</li></ul>
84
234
* @return array
85
235
*/
86
236
publicfunctionsetBarcode($code, $type) {
87
237
$mode = explode(',', $type);
88
238
$qrtype = strtoupper($mode[0]);
89
239
switch ($qrtype) {
90
-
case'QRCODE': { // QR-CODE
91
-
require_once(dirname(__FILE__).'/qrcode.php');
92
-
if (!isset($mode[1]) OR (!in_array($mode[1],array('L','M','Q','H')))) {
0 commit comments