man:barcode(1)
Z funus.net
(Przekierowano z Barcode)
BARCODE(1) GNU barcode BARCODE(1)
NAME
barcode — a stand alone program to run the barcode library
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
Printausagesummaryandexit.
-i filename
Identifyafilewherestringstobeencodedarereadfrom.If miss-
ing(andif-bisnotused)itdefaultstostandard input.Eachdataline-
oftheinputfilewillbeusedtocreate onebarcodeoutput.
-o filename
Outputfile.Itdefaultstostandardoutput.
-b string
Specifyasingle``barcode''stringtobeencoded. Theoptioncanbeused-
multipletimesinordertoencode multiplestrings(thiswillresultin-
multi-pagepostscript outputoratableofbarcodesif-tisspeci-
fied).The stringsmustmatchtheencodingchosen;ifitdoesn't
matchtheprogramwillprintawarningtostderrand gener-
ate``blank''output(althoughnotzero-length). Pleasenotethatas-
tringincludingspacesor otherspecialcharactersmustbeproper-
lyquoted.
-e encoding
encodingisthenameofthechosenencodingformatbeing used.Itdefault-
stothevalueoftheenvironmentvariable BARCODE_ENCODINGortoautode-
tectioniftheenvironmentis alsounset.
-g geometry
Thegeometryargumentisoftheform``[x ][++]''(with nointerveningspaces).Unspecifiedmargin-
valueswillresultin nomargin;unspecifiedsizeresultsindefaultsize.
Thespecifiedvaluesrepresentprintpointsby default,andcan-
beinches,millimetersorotherunits accordingtothe-uoptionortheBAR-
CODE_UNIT environmentvariable.Theargumentisusedtoplacethe print-
outcodeonthepage.Notethatanadditionalwhite
marginof10pointsisaddedtotheprintout.Iftheoptionis unspeci-
fied,BARCODE_GEOMETRYislookedupinthe environment,ifmissingade-
faultsizeandnomargin(butthe default10points)areused.
-t table-geometry
Usedtoprintseveralbarcodestoasinglepage,thisoption ismeantto-
beusedtoprintstickers.Theargumentisofthe
form``x[+
+[-[- ]]]''(withnointer-
veningspaces);ifmissing, thetopandrightmarginwilldefaulttobethe-
sameasthe bottomandleftmargin.Themarginsarespecifiedinprint
pointsorinthechosenunit(see-ubelow).Ifthe optionisnotspeci-
fied,BARCODE_TABLEislookedupinthe environment,otherwiseno-
tableisprintedandeachbarcode willgetitsownpage.Thesize(butnot-
theposition) ofabarcodeitemwithinatablecanalsobeselectedusing
-g(see"geometry"above),withoutstrugglingwith externalandinter-
nalmargins.Istillthinkmanagementof geometriesinatableissubopti-
mal,butIcan'tmakeit betterwithoutintroducingincompatibilities.
-m margin(s)
Specifiesaninternalmarginforeachstickerinthe table.Theargumenti-
softheform ``,''andthemarginisapplied symmet-
ricallytothesticker.Ifunspecified,theenvironment variableBAR-
CODE_MARGINisusedoradefaultinternal marginof10pointsisused.
-n ``Numeric''output:don'tprinttheASCIIformofthecode, onlythebars.
-c Nochecksumcharacter(forencodingsthatallowit,likecode39, other-
codes,likeUPCorEAN,ignorethisoption).
-E Encapsulatedpostscript(defaultisnormalpostscript).When theout-
putisgeneratedasEPSonlyonebarcodeisencoded.
-P PCLoutput.PleasenotethattheYdirectiongoesfromtop tobottomfor-
PCL,andtheoriginforanimageisthetop-left cornerinsteadofthebot-
tom-left
-p pagesize
Specifyanon-defaultpagesize.Thepagesizecanbespecified inmillime-
ters,inchesorplainnumbers(forexample:"210x297mm",
"8.5x11in","595x842").Apagespecificationasnumbers willbeinter-
pretedaccordingtothecurrentunitspecification (see-ubelow).Iflib-
paperisavailable, youcanalsospecifythepagesizewithit-
sname,like"A3" or"letter"(libpaperisastandardcomponentofDebian
GNU/Linux,butmaybemissingelsewhere).Thedefaultpage sizeisy-
oursystem-widedefaultiflibpaperisthere,A4otherwise.
-u unit
Choosetheunitusedinsizespecifications.Acceptedvalues
are``mm'',``cm'',``in''and``pt''.Bydefault,theprogram willcheck-
BARCODE_UNITintheenvironment,andassume pointsotherwise(thisbe-
haviouriscompatiblewith0.92and previousversions.If-uap-
pearsmorethanonce,each instancewillmodifiedthebehaviourforthear-
gumentsatits right,asthecommandlineisprocesseslefttoright.The
programinternallyworkswithpoints,andanysizeis approximatedtothe-
nearestmultipleofonepoint.The-u optionaffect-g(geometry),-t(ta-
ble)and-p (pagesize).
ENCODING TYPES
The program encodes text strings passed either on the command line
(with -b) or retrieved from standard input. The text representation is
interpreted according to the following 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 TheEANfrontendissimilartoUPC;itacceptsstringsof dig-
its,12or7characterslong.Stringsof13or8characters areaccepte-
diftheprovidedchecksumdigitiscorrect. Iexpectmostuserstofeedin-
putwithouta
checksum,though.Theadd-2andadd-5extensionareacceptedforboth
theEAN-13andtheEAN-8encodings. Thefollowingareexampleofvalidin-
putstrings: ``123456789012''(EAN-13),``1234567890128''(EAN-13wih
checksum),``1234567''(EAN-8),``1234567012345''(EAN-8 withcheck-
sumandadd-5), ``12345678901212''(EAN-13withadd-2),
``12345678901212345''(EAN-13withadd-5).
UPC TheUPCfrontendacceptsonlystringsmadeupofdigits(and, ifasupple-
mentalencodingisused,ablanktoseparateit). Itacceptsstring-
sof11or12digits(UPC-A)and6or7or8 digits(UPC-E).
The12thdigitofUPC-Aisthechecksumandisaddedbythe libraryifnotspeci-
fiedintheinput;ifitisspecified,it mustbetherightchecksumorthecodeisre-
jectedasinvalid. ForUPC-E,6digitareconsideredtobethemiddlepartofthe
code,aleading0isassumedandthechecksumisadded; 7digitsareeitherconsid-
eredtheinitialpart(leadingdigit 0or1,checksummissing)orthefinal-
part(checksumspecified, leading0assumed);8digitsareconsideredtobethe-
completecode, withleading0or1andchecksum. ForbothUPC-AandUPC-E,atrail-
ingstringof2digitsor5digits isacceptedaswell.Therefore,thefollowingare-
examples ofvalidstringsthatcanbeencodedasUPC: ``01234567890''(UPC-A)
``012345678905''(UPC-Awithchecksum),``012345'' (UPC-
E),``0123456789012''(UPC-A,add-2)and ``0123456789012345''(UPC-
A,add-5),``012345612'' (UPC-E,add-2). PleasenotethatwhensettingBAR-
CODE_ANYtoauto-detect theencodingtobeused,12-digitstringsand7-digit-
strings willalwaysbeidentifiedasEAN.ThisbecauseIexpectmost userto-
provideinputwithoutachecksum.Ifyouneedto specifyUPC-with-checksumasin-
putyoumustexplicitlyset BARCODE_UPCasaflagoruse-eupconthecommandline.
ISBN ISBNnumbersareencodedasEAN-13symbols,withanoptional
add-5trailer.TheISBNfrontendofthelibraryacceptsreal ISBNnumber-
sanddealswithanyhyphenand,ifpresent,the ISBNchecksumcharacterbe-
foreencodingdata.Valid representationsforISBNstringsareforexam-
ple: ``1-56592-292-1'',``3-89721-122-X''and``3-89721-122-X
06900}''.
code 128-B
ThisencodingcanrepresentalloftheprintingASCII charac-
ters,[[man:fromthespace(32)|fromthespace(32)]][[man:toDEL(127)|toDEL(127)]].Thechecksum digitismandato-
ryinthisencoding.
code 128-C
The``C''variationofCode-128usesCode-128symbolsto repre-
senttwodigitsatatime(Code-128ismadeupof104 symbolswhoseinterpre-
tationiscontrolledbythestartsymbol beingused).Code128-Cisthus-
themostcompactwayto representanyevennumberofdigits.Theencoder-
refusesto dealwithanoddnumberofdigitsbecausethecalleris expect-
edtoprovideproperpaddingtoanevennumberof digits.(Since-
Code-128includescontrolsymbolstoswitch charset,itistheoretical-
lypossibletorepresenttheodd digitasaCode128-Aor128-Bsymbol,but-
thistooldoesn't currentlyimplementthisoption).
code 128 raw
Code-128outputrepresentedsymbol-by-symbolintheinput
string.Tooverridepartoftheproblemsoutlinedbelowin specifying-
code128symbols,thispseudo-encodingallowsthe usedtospecifyal-
istofcode128symbolsseparatedby spaces.Eachsymbolisrepresented-
byanumberintherange 0-105.Thelistshouldincludetheleadingcharac-
ter.The checksumandthestopcharacterareautomaticallyaddedbythe
library.Mostlikelythispseudo-encodingwillbeusedwith BAR-
CODE_NO_ASCIIandsomeexternalprogramtosupplythe printedtext.
code 39
Thecode-39standardcanencodeuppercaseletters,digits,the
blankspace,plus,minus,dot,star,dollar,slash,percent. Anys-
tringthatisonlycomposedofsuchcharactersis
acceptedbythecode-39encoder.Toavoidloosinginformation, theen-
coderrefusestoencodemixed-casestrings(alowercase stringis-
nonethelessacceptedasashortcut,butisencoded asuppercase).
interleaved 2 of 5
Thisencodingcanonlyrepresentanevennumberofdigits (odddigitsar-
erepresentedbybars,andevendigitsbythe interleav-
ingspaces).Thenamestressesthefactthattwo ofthefiveitems(bar-
sorspaces)allocatedtoeachsymbol arewide,whiletherestarenar-
row.Thechecksumdigitis optional(canbedisabledviaBAR-
CODE_NO_CHECKSUM). Sincethenumberofdigits,includingthecheck-
sum,mustbeeven, aleadingzeroisinsertedinthestringbeingencoded-
ifneeded (thisisspecificallystatedinthespecsIhaveaccessto).
code 128
AutomaticselectionbetweenalphabetA,BandCoftheCode-128 stan-
dard.ThisencodingcanrepresentallASCIIsymbols,from
0(NUL)to127(DEL),aswellasfourspecialsymbols,named
F1,F2,F3,F4.Thesetofsymbolsavailableinthisencoding isnoteasi-
lyrepresentedasinputtothebarcodelibrary, sothefollowingconven-
tionisused.Intheinputstring, whichisaC-languagenull-terminated-
string,theNULchar isrepresentedbythe-
value128(0x80,0200)andtheF1-F4characters arerepresentedbytheval-
ues193-196(0xc1-0xc4,0301-0304). Thevalueshavebeenchosen-
toeasetheirrepresentationas escapesequences.
Sincetheshelldoesn'tseemtointerpretescapesequencesonthe command-
line,the"-b"optioncannotbeeasilyusedtodesignate thestringstobeen-
coded.Asaworkaroundyoucanresort tothecommandecho,eitherwithinback-tick-
sorused separatelytocreateafilethatisthenfedtothestandard-input ofbar-
code--assumingyourechocommandprocessesescape sequences.Thenewlinechar-
acterisespeciallythoughtoencode (butnotimpossibleunlessyouuseacshvari-
ant.
Theseproblemsonlyapplytothecommand-linetool;theuseof libraryfunctions-
doesn'tgiveanyproblem.Inneeded,youcan usethe``code128raw''pseudo-encod-
ingtorepresent code128symbolsbytheirnumericalvalue.Thisencodingis used-
lateintheauto-selectionmechanismbecause(almost)any inputstringcanberep-
resentedusingcode128.
Codabar
Codabarcanencodethetendigitsandafewspecialsymbols
(minus,plus,dollar,colon,bar,dot).Thecharacters
``A'',``B'',``C''and``D''areusedto representfourdiffer-
entstart/stopcharacters.Theinput stringtothebarcodelibrarycanin-
cludethestartandstop charactersornotincludethem(inwhich-
case``A''is usedasstartand``B''asstop).Startandstop charac-
tersintheinputstringcanbeeitheralllowercaseor alluppercasean-
darealwaysprintedasuppercase.
Plessey
Plesseybarcodescanencodeallthehexadecimal digits.Alphabeticdig-
itsintheinputstringmusteitherbe alllowercaseoralluppercase.The-
outputtextisalways uppercase.
MSI MSIcanonlyencodethedecimaldigits.Whilethestandard specifiesei-
theroneortwocheckdigits,thecurrent implementationinthislibrary-
onlygeneratesonecheckdigit.
code 93
Thecode-93standardcannativelyencode48differentcharacters,
includinguppercaseletters,digits,theblankspace,plus,minus,
dot,star,dollar,slash,percent,aswellasfivespecial charac-
ters:astart/stopdelimiterandfour"shiftcharacters"used
forextendedencoding.Usingthis"extendedencoding"method,any stan-
dard7-bitASCIIcharactercanbeencoded,butittakesuptwo symbol-
lengthsinbarcodeifthecharacterisnotnativelysupported (one-
ofthe48). Theencoderherefullyimplementsthecode93encodingstan-
dard. Anycharactersnativelysupported(A-Z,0-9,".+-/$ encodedas-
such-foranyothercharacters(suchaslowercase letters,brack-
ets,parentheses,etc.),theencoderwillrevert toextendedencoding.
Asanote,theoptiontoexcludethechecksumwilleliminatethe twomod-
ulo-47checksums(calledCandK)fromthebarcode,butthis probablywill-
makeitunreadableby9 Thesechecksumsarespecifiedtobeusedatthe-
firmwarelevel, andtheirabsencewillbeinterpretedasaninvalidbar-
code.
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 origin, for PCL you
specify the top-left corner.
Barcode output for PCL Printers (HP LaserJet and compatibles), 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.
The only real difference from one printer to another really depends on
which font are available in the printer, used in printing the label
associated to the bars (if requested).
Earlier LaserJet supports only bitmaps fonts, so these are not "scal-
able". (Ljet II ?), Also these fonts, when available, have a specified
direction, and not all of them are available in both Portrait and Land-
scape mode.
From LaserJet 4 series, (except 4L/5L that are entry-level printers),
Arial scalable font should be available, so 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 BARCODE_OUT_PCL_III instead of BAR-
CODE_OUT_PCL., and font the font used will be "Univers" instead of
"Arial".
Results on compatible printers, may depend on consistency of PCL5 com-
patibility, in doubt, try BARCODE_OUT_PCL_III
PJL commands are not used here, as it's not very compatible.
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 surrounding white space (the problem is especially rele-
vant 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
barcode(3)
AUTHORS
Alessandro Rubini <rubini@gnu.org> (maintainer)
Leonid A. Broukhis <leob@mailcom.com> (several encodings)
Andrea Scopece <a.scopece@tin.it> (PCL output)
4th Berkeley Distribution October 2001 BARCODE(1)