Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
HP & Linux

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Glossary
MoreInfo
Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
FAQ
Copyright Info
Terms of Use
Privacy Info
Disclaimer
WorkBoard
Thanks
Donations
Advertising
Masthead / Impressum
Your Account

Communication
Feedback
Forums
Private Messages
Surveys

Features
HOWTOs
News Archive
Submit News
Topics
User Articles
Web Links

Google
Google


The Web
linux-tutorial.info

Who's Online
There are currently, 200 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here

  

barcode



SYNOPSIS

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


DESCRIPTION

       The  information below is extracted from the texinfo file,
       which is the preferred source of information.

       The barcode program is a front-end to access some features
       of  the library from the command line.  It is able to read
       user supplied strings from the command line or a data file
       (standard input by default) and encode all of them.


OPTIONS

       barcode accepts the following options:

       --help or -h
              Print a usage summary and exit.

       -i filename
              Identify  a  file  where  strings to be encoded are
              read from. If missing (and if -b is  not  used)  it
              defaults  to  standard input. Each data line of the
              input file will be used to create one barcode  out­
              put.

       -o filename
              Output file. It defaults to standard output.

       -b string
              Specify  a single ``barcode'' string to be encoded.
              The option can be used multiple times in  order  to
              encode multiple strings (this will result in multi-
              page postscript output or a table of barcodes if -t
              is specified).  The strings must match the encoding
              chosen; if it doesn't match the program will  print
              a  warning  to stderr and generate ``blank'' output
              (although not zero-length).   Please  note  that  a
              string including spaces or other special characters
              must be properly quoted.

       -e encoding
              encoding is the name of the chosen encoding  format
              being  used.  It defaults to the value of the envi­
              ronment variable BARCODE_ENCODING or to auto detec­
              tion if the environment is also unset.

       -g geometry
              The  geometry  argument is of the form ``[<width> x
              <height>] [+  <xmargin>  +  <ymargin>]''  (with  no
              Used to print several barcodes to  a  single  page,
              this  option is meant to be used to print stickers.
              The argument is of the form ``<columns>  x  <lines>
              [+  <leftmargin>  + <bottommargin> [- <rightmargin>
              [- <topmargin>]]]'' (with no  intervening  spaces);
              if  missing,  the top and right margin will default
              to be the same as the bottom and left  margin.  The
              margins  are  specified  in  print points or in the
              chosen unit (see -u below).  If the option  is  not
              specified,  BARCODE_TABLE is looked up in the envi­
              ronment, otherwise no table  is  printed  and  each
              barcode  will  get its own page.  The size (but not
              the position) of a barcode item within a table  can
              also  be  selected using -g (see "geometry" above),
              without struggling with external and internal  mar­
              gins.   I still think management of geometries in a
              table is suboptimal, but I  can't  make  it  better
              without introducing incompatibilities.

       -m margin(s)
              Specifies  an  internal  margin for each sticker in
              the table. The argument is  of  the  form  ``<xmar­
              gin>,<ymargin>''  and the margin is applied symmet­
              rically to the sticker. If unspecified,  the  envi­
              ronment   variable  BARCODE_MARGIN  is  used  or  a
              default internal margin of 10 points is used.

       -n     ``Numeric'' output: don't print the ASCII  form  of
              the code, only the bars.

       -c     No checksum character (for encodings that allow it,
              like code 39, other codes, like UPC or EAN,  ignore
              this option).

       -E     Encapsulated    postscript   (default   is   normal
              postscript). When the output is  generated  as  EPS
              only one barcode is encoded.

       -P     PCL  output.  Please note that the Y direction goes
              from top to bottom for PCL, and the origin  for  an
              image is the top-left corner instead of the bottom-
              left

       -p pagesize
              Specify a non-default page size. The page size  can
              be  specified  in millimeters, inches or plain num­
              bers   (for   example:   "210x297mm",   "8.5x11in",
              "595x842"). A page specification as numbers will be
              interpreted according to the current unit  specifi­
              cation  (see  -u  below). If libpaper is available,
              you can also specify the page size with  its  name,
              like  "A3" or "letter" (libpaper is a standard com­
              works  with points, and any size is approximated to
              the nearest multiple of one point.  The  -u  option
              affect  -g  (geometry),  -t  (table)  and  -p (page
              size).


ENCODING TYPES

       The program encodes text strings passed either on the com­
       mand  line (with -b) or retrieved from standard input. The
       text representation is interpreted according to  the  fol­
       lowing  rules.  When  auto-detection  of  the  encoding is
       enabled (i.e, no explicit encoding type is specified), the
       encoding types are scanned to find one that can digest the
       text string.  The following list  of  supported  types  is
       sorted  in  the  same  order  the  library uses when auto-
       detecting a suitable encoding for a string.

       EAN    The EAN frontend is  similar  to  UPC;  it  accepts
              strings of digits, 12 or 7 characters long. Strings
              of 13 or 8 characters are accepted if the  provided
              checksum  digit is correct.  I expect most users to
              feed input without a checksum,  though.  The  add-2
              and  add-5  extension  are  accepted  for  both the
              EAN-13 and the EAN-8 encodings.  The following  are
              example  of  valid  input strings: ``123456789012''
              (EAN-13), ``1234567890128'' (EAN-13 wih  checksum),
              ``1234567'' (EAN-8), ``12345670 12345'' (EAN-8 with
              checksum and add-5),  ``123456789012  12''  (EAN-13
              with  add-2),  ``123456789012  12345'' (EAN-13 with
              add-5).

       UPC    The UPC frontend accepts only strings  made  up  of
              digits  (and, if a supplemental encoding is used, a
              blank to separate it).  It accepts strings of 11 or
              12 digits (UPC-A) and 6 or 7 or 8 digits (UPC-E).

       The  12th  digit  of UPC-A is the checksum and is added by
       the library if not specified in the input; if it is speci­
       fied,  it  must  be  the  right  checksum  or  the code is
       rejected as invalid.  For UPC-E, 6 digit are considered to
       be the middle part of the code, a leading 0 is assumed and
       the checksum is added; 7 digits are either considered  the
       initial  part  (leading digit 0 or 1, checksum missing) or
       the final part (checksum specified, leading 0 assumed);  8
       digits  are considered to be the complete code, with lead­
       ing 0 or 1 and checksum.  For  both  UPC-A  and  UPC-E,  a
       trailing  string  of  2  digits or 5 digits is accepted as
       well. Therefore,  the  following  are  examples  of  valid
       strings  that can be encoded as UPC: ``01234567890'' (UPC-
       A)  ``012345678905''  (UPC-A  with  checksum),  ``012345''
              acter  before  encoding data. Valid representations
              for    ISBN    strings     are     for     example:
              ``1-56592-292-1'',       ``3-89721-122-X''      and
              ``3-89721-122-X 06900}''.

       code 128-B
              This encoding can represent  all  of  the  printing
              ASCII characters, from the space (32) to DEL (127).
              The checksum digit is mandatory in this encoding.

       code 128-C
              The ``C'' variation of Code-128 uses Code-128  sym­
              bols to represent two digits at a time (Code-128 is
              made up of 104 symbols whose interpretation is con­
              trolled by the start symbol being used). Code 128-C
              is thus the most compact way to represent any  even
              number  of digits. The encoder refuses to deal with
              an odd number  of  digits  because  the  caller  is
              expected  to provide proper padding to an even num­
              ber of digits.  (Since  Code-128  includes  control
              symbols to switch charset, it is theoretically pos­
              sible to represent the odd digit as a Code 128-A or
              128-B  symbol,  but  this  tool  doesn't  currently
              implement this option).

       code 128 raw
              Code-128 output represented symbol-by-symbol in the
              input  string.   To  override  part of the problems
              outlined below in specifying code128 symbols,  this
              pseudo-encoding  allows  the used to specify a list
              of code128 symbols separated by spaces. Each symbol
              is represented by a number in the range 0-105.  The
              list  should  include  the  leading   character.The
              checksum  and  the stop character are automatically
              added by the  library.  Most  likely  this  pseudo-
              encoding  will  be  used  with BARCODE_NO_ASCII and
              some external program to supply the printed text.

       code 39
              The code-39 standard can encode uppercase  letters,
              digits,  the  blank  space, plus, minus, dot, star,
              dollar, slash, percent.  Any string  that  is  only
              composed  of  such  characters  is  accepted by the
              code-39 encoder. To avoid loosing information,  the
              encoder  refuses  to  encode  mixed-case strings (a
              lowercase  string  is  nonetheless  accepted  as  a
              shortcut, but is encoded as uppercase).

       interleaved 2 of 5
              This  encoding can only represent an even number of
              digits (odd digits are  represented  by  bars,  and
              even  digits  by the interleaving spaces). The name
              The  set  of  symbols available in this encoding is
              not easily represented  as  input  to  the  barcode
              library,  so  the following convention is used.  In
              the input string, which is a C-language null-termi­
              nated  string,  the  NUL char is represented by the
              value 128 (0x80, 0200) and the F1-F4 characters are
              represented   by  the  values  193-196  (0xc1-0xc4,
              0301-0304).  The values have been  chosen  to  ease
              their representation as escape sequences.

       Since the shell doesn't seem to interpret escape sequences
       on the command line, the "-b" option cannot be easily used
       to  designate  the  strings to be encoded. As a workaround
       you can resort to the command echo,  either  within  back-
       ticks or used separately to create a file that is then fed
       to the standard-input of barcode  --  assuming  your  echo
       command processes escape sequences.  The newline character
       is especially though to encode (but not impossible  unless
       you use a csh variant.

       These  problems  only  apply to the command-line tool; the
       use of library functions  doesn't  give  any  problem.  In
       needed,  you  can use the ``code 128 raw'' pseudo-encoding
       to represent code128 symbols  by  their  numerical  value.
       This encoding is used late in the auto-selection mechanism
       because (almost) any input string can be represented using
       code128.

       Codabar
              Codabar can encode the ten digits and a few special
              symbols (minus, plus, dollar, colon, bar, dot). The
              characters  ``A'',  ``B'', ``C'' and ``D'' are used
              to represent four different start/stop  characters.
              The input string to the barcode library can include
              the start and stop characters or not  include  them
              (in  which case ``A'' is used as start and ``B'' as
              stop). Start  and  stop  characters  in  the  input
              string can be either all lowercase or all uppercase
              and are always printed as uppercase.

       Plessey
              Plessey barcodes can  encode  all  the  hexadecimal
              digits.  Alphabetic digits in the input string must
              either be all lowercase or all uppercase. The  out­
              put text is always uppercase.

       MSI    MSI  can  only encode the decimal digits. While the
              standard specifies either one or two check  digits,
              the  current  implementation  in  this library only
              generates one check digit.
              ".+-/$ encoded as such - for any  other  characters
              (such as lower case letters, brackets, parentheses,
              etc.), the encoder will revert to  extended  encod­
              ing.  As a note, the option to exclude the checksum
              will eliminate the two modulo-47 checksums  (called
              C  and  K) from the barcode, but this probably will
              make it unreadable by 9 These checksums are  speci­
              fied  to  be  used at the firmware level, and their
              absence will be interpreted as an invalid  barcode.


PCL OUTPUT

       While the default output is Postscript (possibly EPS), and
       Postscript can be post-processed to almost anything, it is
       sometimes  desirable  to  create output directly usable by
       the specific printer at hand.  PCL is currently  supported
       as an output format for this reason.  Please note that the
       Y coordinate for PCL goes from top to  bottom,  while  for
       Postscript it goes from bottom to top. Consistently, while
       in Postscript you specify the bottom-left corner  as  ori­
       gin, for PCL you specify the top-left corner.

       Barcode  output for PCL Printers (HP LaserJet and compati­
       bles), was developed using PCL5 Reference manuals from HP.
       that really refers to these printers:

       LaserJet III, III P, III D, III Si,

       LaserJet 4 family

       LaserJet 5 family

       LaserJet 6 family

       Color LaserJet

       DeskJet 1200 and 1600.

       However, barcode printing uses a very small subset of PCL,
       probably also LaserJet II should print it without problem,
       but the resulting text may be horrible.

       it's the "default font" used by this program.

       LaserJet  III  series printers (and 4L, 5L), don't feature
       "Arial" as  a  resident  font,  so  you  should  use  BAR­
       CODE_OUT_PCL_III instead of BARCODE_OUT_PCL., and font the
       font used will be "Univers" instead of "Arial".

       Results on compatible printers, may depend on  consistency
       of PCL5 compatibility, in doubt, try BARCODE_OUT_PCL_III

       PJL  commands are not used here, as it's not very compati­
       ble.

       Tested Printers:

       Hp LaserJet 4050

       Hp LaserJet 2100

       Epson N-1200 emul PCL

       Toshiba DP2570 (copier) + PCL option

       Epson EPL-7100 emul. HP LaserJet II: bars print  fine  but
       text is bad.


BUGS

       The current management  of  borders/margins  is  far  from
       optimal.  The  ``default''  margin  applied by the library
       interferes with the external representation, but I feel it
       is mandatory to avoid creating barcode output with no sur­
       rounding white space (the problem is  especially  relevant
       for EPS output).

       EAN-128  is  not  (yet)  supported. I plan to implement it
       pretty soon and then bless the package as version 1.0.


SEE ALSO


  
Show your Support for the Linux Tutorial

Purchase one of the products from our new online shop. For each product you purchase, the Linux Tutorial gets a portion of the proceeds to help keep us going.


Login
Nickname

Password

Security Code
Security Code
Type Security Code


Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!


Amazon Wish List

Did You Know?
You can get all the latest Site and Linux news by checking out our news page.


Friends



Tell a Friend About Us

Bookmark and Share



Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.04 Seconds