1BARCODE(1)                        GNU barcode                       BARCODE(1)
2
3
4

NAME

6       barcode - a stand alone program to run the barcode library
7

SYNOPSIS

9       barcode [-b - | string] [-e encoding] [-o - | outfile] [ other-flags ]
10

DESCRIPTION

12       The  information below is extracted from the texinfo file, which is the
13       preferred source of information.
14
15       The barcode program is a front-end  to  access  some  features  of  the
16       library  from  the  command  line.   It  is  able to read user supplied
17       strings from the command  line  or  a  data  file  (standard  input  by
18       default) and encode all of them.
19
20

OPTIONS

22       barcode accepts the following options:
23
24       --help or -h
25              Print a usage summary and exit.
26
27       -i filename
28              Identify  a  file  where strings to be encoded are read from. If
29              missing (and if -b is not used) it defaults to  standard  input.
30              Each data line of the input file will be used to create one bar‐
31              code output.
32
33       -o filename
34              Output file. It defaults to standard output.
35
36       -b string
37              Specify a single ``barcode'' string to be encoded.   The  option
38              can  be  used multiple times in order to encode multiple strings
39              (this will result in multi-page postscript output or a table  of
40              barcodes if -t is specified).  The strings must match the encod‐
41              ing chosen; if it doesn't match the program will print a warning
42              to  stderr  and  generate  ``blank''  output (although not zero-
43              length).  Please note that a string including  spaces  or  other
44              special characters must be properly quoted.
45
46       -e encoding
47              encoding  is  the name of the chosen encoding format being used.
48              It defaults to  the  value  of  the  environment  variable  BAR‐
49              CODE_ENCODING  or  to  auto detection if the environment is also
50              unset.
51
52       -g geometry
53              The geometry argument is of the form ``[<width> x  <height>]  [+
54              <xmargin>  + <ymargin>]'' (with no intervening spaces). Unspeci‐
55              fied margin values will result in no  margin;  unspecified  size
56              results  in  default size.  The specified values represent print
57              points by default, and can be inches, millimeters or other units
58              according to the -u option or the BARCODE_UNIT environment vari‐
59              able.  The argument is used to place the printout  code  on  the
60              page. Note that an additional white margin of 10 points is added
61              to the printout. If the option is unspecified,  BARCODE_GEOMETRY
62              is  looked  up in the environment, if missing a default size and
63              no margin (but the default 10 points) are used.
64
65       -t table-geometry
66              Used to print several barcodes to a single page, this option  is
67              meant  to be used to print stickers. The argument is of the form
68              ``<columns>  x  <lines>  [+  <leftmargin>  +  <bottommargin>  [-
69              <rightmargin>  [- <topmargin>]]]'' (with no intervening spaces);
70              if missing, the top and right margin will default to be the same
71              as  the  bottom  and  left  margin. The margins are specified in
72              print points or in the chosen  unit  (see  -u  below).   If  the
73              option is not specified, BARCODE_TABLE is looked up in the envi‐
74              ronment, otherwise no table is printed and each barcode will get
75              its own page.  The size (but not the position) of a barcode item
76              within a table can also be selected  using  -g  (see  "geometry"
77              above),  without  struggling with external and internal margins.
78              I still think management of geometries in a table is suboptimal,
79              but  I  can't  make it better without introducing incompatibili‐
80              ties.
81
82       -m margin(s)
83              Specifies an internal margin for each sticker in the table.  The
84              argument  is  of the form ``<xmargin>,<ymargin>'' and the margin
85              is applied symmetrically to the  sticker.  If  unspecified,  the
86              environment  variable BARCODE_MARGIN is used or a default inter‐
87              nal margin of 10 points is used.
88
89       -n     ``Numeric'' output: don't print the ASCII form of the code, only
90              the bars.
91
92       -c     No  checksum  character  (for encodings that allow it, like code
93              39, other codes, like UPC or EAN, ignore this option).
94
95       -E     Encapsulated postscript (default is normal postscript). When the
96              output is generated as EPS only one barcode is encoded.
97
98       -P     PCL  output.  Please  note that the Y direction goes from top to
99              bottom for PCL, and the origin for an image is the top-left cor‐
100              ner instead of the bottom-left
101
102       -p pagesize
103              Specify  a non-default page size. The page size can be specified
104              in  millimeters,  inches  or   plain   numbers   (for   example:
105              "210x297mm",  "8.5x11in",  "595x842").  A  page specification as
106              numbers will be interpreted according to the current unit speci‐
107              fication  (see -u below). If libpaper is available, you can also
108              specify the page size with its name, like "A3" or "letter" (lib‐
109              paper  is  a  standard component of Debian GNU/Linux, but may be
110              missing elsewhere). The default page size  is  your  system-wide
111              default if libpaper is there, A4 otherwise.
112
113       -u unit
114              Choose the unit used in size specifications. Accepted values are
115              ``mm'', ``cm'', ``in'' and ``pt''. By default, the program  will
116              check  BARCODE_UNIT in the environment, and assume points other‐
117              wise (this behaviour is compatible with 0.92 and  previous  ver‐
118              sions. If -u appears more than once, each instance will modified
119              the behaviour for the arguments at its  right,  as  the  command
120              line  is  processes  left to right. The program internally works
121              with points, and any size is approximated to the nearest  multi‐
122              ple of one point. The -u option affect -g (geometry), -t (table)
123              and -p (page size).
124
125

ENCODING TYPES

127       The program encodes text strings passed  either  on  the  command  line
128       (with  -b) or retrieved from standard input. The text representation is
129       interpreted according to the following rules.  When  auto-detection  of
130       the  encoding is enabled (i.e, no explicit encoding type is specified),
131       the encoding types are scanned to find one that  can  digest  the  text
132       string.   The  following  list of supported types is sorted in the same
133       order the library uses when auto-detecting a suitable  encoding  for  a
134       string.
135
136       EAN    The  EAN  frontend is similar to UPC; it accepts strings of dig‐
137              its, 12 or 7 characters long. Strings of 13 or 8 characters  are
138              accepted  if  the  provided checksum digit is correct.  I expect
139              most users to feed input without a checksum, though.  The  add-2
140              and  add-5  extension  are  accepted for both the EAN-13 and the
141              EAN-8 encodings.  The  following  are  example  of  valid  input
142              strings:  ``123456789012''  (EAN-13),  ``1234567890128'' (EAN-13
143              wih checksum),  ``1234567'' (EAN-8), ``12345670  12345''  (EAN-8
144              with  checksum  and  add-5),  ``123456789012  12''  (EAN-13 with
145              add-2), ``123456789012 12345'' (EAN-13 with add-5).
146
147       UPC    The UPC frontend accepts only strings made up of digits (and, if
148              a  supplemental  encoding  is used, a blank to separate it).  It
149              accepts strings of 11 or 12 digits (UPC-A) and 6 or 7 or 8  dig‐
150              its (UPC-E).
151
152
153       The  12th digit of UPC-A is the checksum and is added by the library if
154       not specified in the input; if it is specified, it must  be  the  right
155       checksum  or  the  code is rejected as invalid.  For UPC-E, 6 digit are
156       considered to be the middle part of the code, a leading  0  is  assumed
157       and  the  checksum is added; 7 digits are either considered the initial
158       part (leading digit 0 or 1, checksum missing) or the final part (check‐
159       sum  specified,  leading  0 assumed); 8 digits are considered to be the
160       complete code, with leading 0 or 1 and checksum.  For  both  UPC-A  and
161       UPC-E,  a  trailing string of 2 digits or 5 digits is accepted as well.
162       Therefore, the following are examples of  valid  strings  that  can  be
163       encoded  as  UPC:  ``01234567890'' (UPC-A) ``012345678905'' (UPC-A with
164       checksum), ``012345'' (UPC-E), ``01234567890 12''  (UPC-A,  add-2)  and
165       ``01234567890  12345''  (UPC-A,  add-5), ``0123456 12'' (UPC-E, add-2).
166       Please note that when setting BARCODE_ANY to auto-detect  the  encoding
167       to be used, 12-digit strings and 7-digit strings will always be identi‐
168       fied as EAN. This because I expect most user to provide input without a
169       checksum.  If  you  need to specify UPC-with-checksum as input you must
170       explicitly set BARCODE_UPC as a flag or use -e upc on the command line.
171
172       ISBN   ISBN numbers are encoded as EAN-13  symbols,  with  an  optional
173              add-5  trailer.  The  ISBN  frontend of the library accepts real
174              ISBN numbers and deals with any hyphen and, if present, the ISBN
175              checksum  character  before encoding data. Valid representations
176              for   ISBN   strings   are   for   example:   ``1-56592-292-1'',
177              ``3-89721-122-X'' and ``3-89721-122-X 06900}''.
178
179       code 128-B
180              This  encoding  can  represent all of the printing ASCII charac‐
181              ters, from the space (32) to DEL (127). The  checksum  digit  is
182              mandatory in this encoding.
183
184       code 128-C
185              The  ``C'' variation of Code-128 uses Code-128 symbols to repre‐
186              sent two digits at a time (Code-128 is made up  of  104  symbols
187              whose  interpretation  is  controlled  by the start symbol being
188              used). Code 128-C is thus the most compact way to represent  any
189              even  number  of digits. The encoder refuses to deal with an odd
190              number of digits because  the  caller  is  expected  to  provide
191              proper  padding  to  an  even  number of digits. (Since Code-128
192              includes control symbols to switch charset, it is  theoretically
193              possible  to  represent  the  odd digit as a Code 128-A or 128-B
194              symbol, but this tool doesn't currently implement this option).
195
196       code 128 raw
197              Code-128  output  represented  symbol-by-symbol  in  the   input
198              string.   To  override  part  of  the problems outlined below in
199              specifying code128 symbols, this pseudo-encoding allows the used
200              to  specify  a list of code128 symbols separated by spaces. Each
201              symbol is represented by a number in the range 0-105.  The  list
202              should  include  the leading character.The checksum and the stop
203              character are automatically added by the  library.  Most  likely
204              this pseudo-encoding will be used with BARCODE_NO_ASCII and some
205              external program to supply the printed text.
206
207       code 39
208              The code-39 standard can encode uppercase letters,  digits,  the
209              blank  space,  plus,  minus,  dot, star, dollar, slash, percent.
210              Any string that is only composed of such characters is  accepted
211              by  the  code-39  encoder.  To  avoid  loosing  information, the
212              encoder refuses to encode mixed-case strings (a lowercase string
213              is  nonetheless accepted as a shortcut, but is encoded as upper‐
214              case).
215
216       interleaved 2 of 5
217              This encoding can only represent an even number of  digits  (odd
218              digits  are  represented  by bars, and even digits by the inter‐
219              leaving spaces). The name stresses the fact that two of the five
220              items  (bars or spaces) allocated to each symbol are wide, while
221              the rest are narrow. The checksum digit is optional (can be dis‐
222              abled  via  BARCODE_NO_CHECKSUM).   Since  the number of digits,
223              including the checksum, must be even, a leading zero is inserted
224              in  the  string  being  encoded  if needed (this is specifically
225              stated in the specs I have access to).
226
227       code 128
228              Automatic selection between alphabet A, B and C of the  Code-128
229              standard.  This encoding can represent all ASCII symbols, from 0
230              (NUL) to 127 (DEL), as well as four special symbols,  named  F1,
231              F2, F3, F4. The set of symbols available in this encoding is not
232              easily represented as input to the barcode library, so the  fol‐
233              lowing  convention  is used.  In the input string, which is a C-
234              language null-terminated string, the NUL char is represented  by
235              the  value  128 (0x80, 0200) and the F1-F4 characters are repre‐
236              sented by the values 193-196 (0xc1-0xc4, 0301-0304).  The values
237              have   been  chosen  to  ease  their  representation  as  escape
238              sequences.
239
240
241       Since the shell doesn't seem to interpret escape sequences on the  com‐
242       mand  line,  the  "-b"  option  cannot  be easily used to designate the
243       strings to be encoded. As a workaround you can resort  to  the  command
244       echo, either within back-ticks or used separately to create a file that
245       is then fed to the standard-input of barcode -- assuming your echo com‐
246       mand  processes  escape sequences.  The newline character is especially
247       though to encode (but not impossible unless you use a csh variant.
248
249
250       These problems only apply to the command-line tool; the use of  library
251       functions  doesn't  give any problem. In needed, you can use the ``code
252       128 raw'' pseudo-encoding to represent code128 symbols by their numeri‐
253       cal  value.  This encoding is used late in the auto-selection mechanism
254       because (almost) any input string can be represented using code128.
255
256       Codabar
257              Codabar can encode the ten digits  and  a  few  special  symbols
258              (minus,  plus,  dollar,  colon, bar, dot). The characters ``A'',
259              ``B'', ``C'' and ``D'' are  used  to  represent  four  different
260              start/stop  characters.  The input string to the barcode library
261              can include the start and stop characters or  not  include  them
262              (in  which case ``A'' is used as start and ``B'' as stop). Start
263              and stop characters in the input string can be either all lower‐
264              case or all uppercase and are always printed as uppercase.
265
266       Plessey
267              Plessey  barcodes  can encode all the hexadecimal digits. Alpha‐
268              betic digits in the input string must either be all lowercase or
269              all uppercase. The output text is always uppercase.
270
271       MSI    MSI can only encode the decimal digits. While the standard spec‐
272              ifies either one or two check digits, the current implementation
273              in this library only generates one check digit.
274
275       code 93
276              The  code-93  standard  can natively encode 48 different charac‐
277              ters, including uppercase  letters,  digits,  the  blank  space,
278              plus,  minus, dot, star, dollar, slash, percent, as well as five
279              special characters:  a  start/stop  delimiter  and  four  "shift
280              characters"  used for extended encoding.    Using this "extended
281              encoding" method, any standard  7-bit  ASCII  character  can  be
282              encoded,  but  it  takes up two symbol lengths in barcode if the
283              character is not  natively  supported  (one  of  the  48).   The
284              encoder  here  fully  implements  the code 93 encoding standard.
285              Any characters natively supported (A-Z, 0-9, ".+-/$  encoded  as
286              such  -  for  any  other characters (such as lower case letters,
287              brackets,  parentheses,  etc.),  the  encoder  will  revert   to
288              extended  encoding.  As a note, the option to exclude the check‐
289              sum will eliminate the two modulo-47 checksums (called C and  K)
290              from the barcode, but this probably will make it unreadable by 9
291              These checksums are specified to be used at the firmware  level,
292              and their absence will be interpreted as an invalid barcode.
293
294

PCL OUTPUT

296       While  the  default output is Postscript (possibly EPS), and Postscript
297       can be post-processed to almost anything, it is sometimes desirable  to
298       create  output directly usable by the specific printer at hand.  PCL is
299       currently supported as an output format for this reason.   Please  note
300       that  the Y coordinate for PCL goes from top to bottom, while for Post‐
301       script it goes from bottom to top. Consistently,  while  in  Postscript
302       you  specify  the bottom-left corner as origin, for PCL you specify the
303       top-left corner.
304
305
306       Barcode output for PCL Printers  (HP  LaserJet  and  compatibles),  was
307       developed  using PCL5 Reference manuals from HP.  that really refers to
308       these printers:
309
310
311       LaserJet III, III P, III D, III Si,
312
313
314       LaserJet 4 family
315
316
317       LaserJet 5 family
318
319
320       LaserJet 6 family
321
322
323       Color LaserJet
324
325
326       DeskJet 1200 and 1600.
327
328
329       However, barcode printing uses a very small  subset  of  PCL,  probably
330       also  LaserJet  II  should  print it without problem, but the resulting
331       text may be horrible.
332
333
334       The only real difference from one printer to another really depends  on
335       which  font  are  available  in the printer, used in printing the label
336       associated to the bars (if requested).
337
338
339       Earlier LaserJet supports only bitmaps fonts, so these are  not  "scal‐
340       able".  (Ljet II ?), Also these fonts, when available, have a specified
341       direction, and not all of them are available in both Portrait and Land‐
342       scape mode.
343
344
345       From  LaserJet  4 series, (except 4L/5L that are entry-level printers),
346       Arial scalable font should be available, so  it's  the  "default  font"
347       used by this program.
348
349
350       LaserJet  III  series printers (and 4L, 5L), don't feature "Arial" as a
351       resident font, so you should use BARCODE_OUT_PCL_III  instead  of  BAR‐
352       CODE_OUT_PCL.,  and  font  the  font  used will be "Univers" instead of
353       "Arial".
354
355
356       Results on compatible printers, may depend on consistency of PCL5  com‐
357       patibility, in doubt, try BARCODE_OUT_PCL_III
358
359
360       PJL commands are not used here, as it's not very compatible.
361
362
363       Tested Printers:
364
365
366       Hp LaserJet 4050
367
368
369       Hp LaserJet 2100
370
371
372       Epson N-1200 emul PCL
373
374
375       Toshiba DP2570 (copier) + PCL option
376
377
378       Epson EPL-7100 emul. HP LaserJet II: bars print fine but text is bad.
379
380

BUGS

382       The  current  management  of  borders/margins  is far from optimal. The
383       ``default'' margin applied by the library interferes with the  external
384       representation,  but  I  feel it is mandatory to avoid creating barcode
385       output with no surrounding white space (the problem is especially rele‐
386       vant for EPS output).
387
388
389       EAN-128  is not (yet) supported. I plan to implement it pretty soon and
390       then bless the package as version 1.0.
391
392

SEE ALSO

394       barcode(3)
395

AUTHORS

397       Alessandro Rubini <rubini@gnu.org> (maintainer)
398
399       Leonid A. Broukhis <leob@mailcom.com> (several encodings)
400
401       Andrea Scopece <a.scopece@tin.it> (PCL output)
402
403
404
4054th Berkeley Distribution        October 2001                       BARCODE(1)
Impressum