5.1 The Command Line

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 output.

-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 environment variable BARCODE_ENCODING or to auto detection if the environment is also unset.

-g geometry

The geometry argument is of the form “[<width> x <height>] [+ <xmargin> + <ymargin>]” (with no intervening spaces). Unspecified margin values will result in no margin; unspecified size results in default size. The specified values represent print points by default, and can be inches, millimeters or other units according to the -u option or the BARCODE_UNIT environment variable. The argument is used to place the printout code on the page. Note that an additional white margin of 10 points is added to the printout. If the option is unspecified, BARCODE_GEOMETRY is looked up in the environment, if missing a default size and no margin (but the default 10 points) are used.

-t table-geometry

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 environment, 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 margins. 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 “<xmargin>,<ymargin>” and the margin is applied symmetrically to the sticker. If unspecified, the environment 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 numbers (for example: "210x297mm", "8.5x11in", "595x842"). A page specification as numbers will be interpreted according to the current unit specification (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 component of Debian GNU/Linux, but may be missing elsewhere). The default page size is your system-wide default if libpaper is there, A4 otherwise.

-u unit

Choose the unit used in size specifications. Accepted values are “mm”, “cm”, “in” and “pt”. By default, the program will check BARCODE_UNIT in the environment, and assume points otherwise (this behaviour is compatible with 0.92 and previous versions. If -u appears more than once, each instance will modified the behaviour for the arguments at its right, as the command line is processes left to right. The program internally 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).