-
Notifications
You must be signed in to change notification settings - Fork 136
/
barcode-readme.html
274 lines (265 loc) · 5.69 KB
/
barcode-readme.html
1
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<html>
<head>
<title>barcode.php readme</title>
<style>
body {
font-family: Helvetica, sans-serif;
padding: 1em;
}
th, td {
padding: 4pt 1em 4pt 0;
vertical-align: top;
}
</style>
</head>
<body>
<h1>barcode.php</h1>
<h3>Generate barcodes from a single PHP file. MIT license.</h3>
<p>Use from a PHP script:</p>
<pre>
include 'barcode.php';
$generator = new barcode_generator();
/* Output directly to standard output. */
$generator->output_image($format, $symbology, $data, $options);
/* Create bitmap image. */
$image = $generator->render_image($symbology, $data, $options);
imagepng($image);
imagedestroy($image);
/* Generate SVG markup. */
$svg = $generator->render_svg($symbology, $data, $options);
echo $svg;
</pre>
<p>Use with GET or POST:</p>
<pre>
barcode.php?f=<i>format</i>&s=<i>symbology</i>&d=<i>data</i>&<i>options</i>
</pre>
<p>e.g.</p>
<pre>
barcode.php?f=png&s=upc-e&d=06543217
barcode.php?f=svg&s=qr&d=HELLO%20WORLD&sf=8&ms=r&md=0.8
</pre>
<h4>Options:</h4>
<table>
<tr>
<td><code>f</code></td>
<td>
Format. One of:
<table>
<tr>
<td>
<code>png</code><br>
<code>gif</code><br>
<code>jpeg</code><br>
<code>svg</code>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><code>s</code></td>
<td>
Symbology (type of barcode). One of:
<table>
<tr>
<td>
<code>upc-a</code><br>
<code>upc-e</code><br>
<code>ean-8</code><br>
<code>ean-13</code><br>
<code>ean-13-pad</code><br>
<code>ean-13-nopad</code><br>
<code>ean-128</code>
</td>
<td>
<code>code-39</code><br>
<code>code-39-ascii</code><br>
<code>code-93</code><br>
<code>code-93-ascii</code><br>
<code>code-128</code><br>
<code>codabar</code><br>
<code>itf</code>
</td>
<td>
<code>qr</code><br>
<code>qr-l</code><br>
<code>qr-m</code><br>
<code>qr-q</code><br>
<code>qr-h</code>
</td>
<td>
<code>dmtx</code><br>
<code>dmtx-s</code><br>
<code>dmtx-r</code><br>
<code>gs1-dmtx</code><br>
<code>gs1-dmtx-s</code><br>
<code>gs1-dmtx-r</code>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><code>d</code></td>
<td>
Data.<br>
For UPC or EAN, use <code>*</code> for missing digit.<br>
For Codabar, use <code>ABCD</code> or <code>ENT*</code>
for start and stop characters.<br>
For QR, encode in Shift-JIS for kanji mode.
</td>
</tr>
<tr>
<td><code>w</code></td>
<td>Width of image. Overrides <code>sf</code> or <code>sx</code>.</td>
</tr>
<tr>
<td><code>h</code></td>
<td>Height of image. Overrides <code>sf</code> or <code>sy</code>.</td>
</tr>
<tr>
<td><code>sf</code></td>
<td>
Scale factor.
Default is 1 for linear barcodes or 4 for matrix barcodes.
</td>
</tr>
<tr>
<td><code>sx</code></td>
<td>Horizontal scale factor. Overrides <code>sf</code>.</td>
</tr>
<tr>
<td><code>sy</code></td>
<td>Vertical scale factor. Overrides <code>sf</code>.</td>
</tr>
<tr>
<td><code>p</code></td>
<td>
Padding.
Default is 10 for linear barcodes or 0 for matrix barcodes.
</td>
</tr>
<tr>
<td><code>pv</code></td>
<td>Top and bottom padding. Default is value of <code>p</code>.</td>
</tr>
<tr>
<td><code>ph</code></td>
<td>Left and right padding. Default is value of <code>p</code>.</td>
</tr>
<tr>
<td><code>pt</code></td>
<td>Top padding. Default is value of <code>pv</code>.</td>
</tr>
<tr>
<td><code>pl</code></td>
<td>Left padding. Default is value of <code>ph</code>.</td>
</tr>
<tr>
<td><code>pr</code></td>
<td>Right padding. Default is value of <code>ph</code>.</td>
</tr>
<tr>
<td><code>pb</code></td>
<td>Bottom padding. Default is value of <code>pv</code>.</td>
</tr>
<tr>
<td><code>bc</code></td>
<td>Background color in <code>#RRGGBB</code> format.</td>
</tr>
<tr>
<td><code>cs</code></td>
<td>Color of spaces in <code>#RRGGBB</code> format.</td>
</tr>
<tr>
<td><code>cm</code></td>
<td>Color of modules in <code>#RRGGBB</code> format.</td>
</tr>
<tr>
<td><code>tc</code></td>
<td>
Text color in <code>#RRGGBB</code> format.
Applies to linear barcodes only.
</td>
</tr>
<tr>
<td><code>tf</code></td>
<td>
Text font for SVG output.
Default is <code>monospace</code>.
Applies to linear barcodes only.
</td>
</tr>
<tr>
<td><code>ts</code></td>
<td>
Text size.
For SVG output, this is in points and the default is 10.
For PNG, GIF, or JPEG output, this is the GD library
built-in font number from 1 to 5 and the default is 1.
Applies to linear barcodes only.
</td>
</tr>
<tr>
<td><code>th</code></td>
<td>
Distance from text baseline to bottom of modules.
Default is 10.
Applies to linear barcodes only.
</td>
</tr>
<tr>
<td><code>ms</code></td>
<td>
Module shape.
One of:
<code>s</code> for square,
<code>r</code> for round, or
<code>x</code> for X-shaped.
Default is <code>s</code>.
Applies to matrix barcodes only.
</td>
</tr>
<tr>
<td><code>md</code></td>
<td>
Module density.
A number between 0 and 1.
Default is 1.
Applies to matrix barcodes only.
</td>
</tr>
<tr>
<td><code>wq</code></td>
<td>
Width of quiet area units.
Default is 1.
Use 0 to suppress quiet area.
</td>
</tr>
<tr>
<td><code>wm</code></td>
<td>
Width of narrow modules and spaces.
Default is 1.
</td>
</tr>
<tr>
<td><code>ww</code></td>
<td>
Width of wide modules and spaces.
Applies to Code 39, Codabar, and ITF only.
Default is 3.
</td>
</tr>
<tr>
<td><code>wn</code></td>
<td>
Width of narrow space between characters.
Applies to Code 39 and Codabar only.
Default is 1.
</td>
</tr>
</table>
</body>
</html>