man barcode (Commandes) - a stand alone program to run the barcode library

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 missing(andif-bisnotused)itdefaultstostandard input.Eachdatalineoftheinputfilewillbeusedtocreate onebarcodeoutput.
-o filename
Outputfile.Itdefaultstostandardoutput.
-b string
Specifyasingle``barcode''stringtobeencoded. Theoptioncanbeusedmultipletimesinordertoencode multiplestrings(thiswillresultinmulti-pagepostscript outputoratableofbarcodesif-tisspecified).The stringsmustmatchtheencodingchosen;ifitdoesn't matchtheprogramwillprintawarningtostderrand generate``blank''output(althoughnotzero-length). Pleasenotethatastringincludingspacesor otherspecialcharactersmustbeproperlyquoted.
-e encoding
encodingisthenameofthechosenencodingformatbeing used.Itdefaultstothevalueoftheenvironmentvariable BARCODE_ENCODINGortoautodetectioniftheenvironmentis alsounset.
-g geometry
Thegeometryargumentisoftheform``[<width>x <height>][+<xmargin>+<ymargin>]''(with nointerveningspaces).Unspecifiedmarginvalueswillresultin nomargin;unspecifiedsizeresultsindefaultsize. Thespecifiedvaluesrepresentprintpointsby default,andcanbeinches,millimetersorotherunits accordingtothe-uoptionortheBARCODE_UNIT environmentvariable.Theargumentisusedtoplacethe printoutcodeonthepage.Notethatanadditionalwhite marginof10pointsisaddedtotheprintout.Iftheoptionis unspecified,BARCODE_GEOMETRYislookedupinthe environment,ifmissingadefaultsizeandnomargin(butthe default10points)areused.
-t table-geometry
Usedtoprintseveralbarcodestoasinglepage,thisoption ismeanttobeusedtoprintstickers.Theargumentisofthe form``<columns>x<lines>[+<leftmargin> +<bottommargin>[-<rightmargin>[- <topmargin>]]]''(withnointerveningspaces);ifmissing, thetopandrightmarginwilldefaulttobethesameasthe bottomandleftmargin.Themarginsarespecifiedinprint pointsorinthechosenunit(see-ubelow).Ifthe optionisnotspecified,BARCODE_TABLEislookedupinthe environment,otherwisenotableisprintedandeachbarcode willgetitsownpage.Thesize(butnottheposition) ofabarcodeitemwithinatablecanalsobeselectedusing -g(see"geometry"above),withoutstrugglingwith externalandinternalmargins.Istillthinkmanagementof geometriesinatableissuboptimal,butIcan'tmakeit betterwithoutintroducingincompatibilities.
-m margin(s)
Specifiesaninternalmarginforeachstickerinthe table.Theargumentisoftheform ``<xmargin>,<ymargin>''andthemarginisapplied symmetricallytothesticker.Ifunspecified,theenvironment variableBARCODE_MARGINisusedoradefaultinternal marginof10pointsisused.
-n
``Numeric''output:don'tprinttheASCIIformofthecode, onlythebars.
-c
Nochecksumcharacter(forencodingsthatallowit,likecode39, othercodes,likeUPCorEAN,ignorethisoption).
-E
Encapsulatedpostscript(defaultisnormalpostscript).When theoutputisgeneratedasEPSonlyonebarcodeisencoded.
-P
PCLoutput.PleasenotethattheYdirectiongoesfromtop tobottomforPCL,andtheoriginforanimageisthetop-left cornerinsteadofthebottom-left
-p pagesize
Specifyanon-defaultpagesize.Thepagesizecanbespecified inmillimeters,inchesorplainnumbers(forexample:"210x297mm", "8.5x11in","595x842").Apagespecificationasnumbers willbeinterpretedaccordingtothecurrentunitspecification (see-ubelow).Iflibpaperisavailable, youcanalsospecifythepagesizewithitsname,like"A3" or"letter"(libpaperisastandardcomponentofDebian GNU/Linux,butmaybemissingelsewhere).Thedefaultpage sizeisyoursystem-widedefaultiflibpaperisthere,A4otherwise.
-u unit
Choosetheunitusedinsizespecifications.Acceptedvalues are``mm'',``cm'',``in''and``pt''.Bydefault,theprogram willcheckBARCODE_UNITintheenvironment,andassume pointsotherwise(thisbehaviouriscompatiblewith0.92and previousversions.If-uappearsmorethanonce,each instancewillmodifiedthebehaviourfortheargumentsatits right,asthecommandlineisprocesseslefttoright.The programinternallyworkswithpoints,andanysizeis approximatedtothenearestmultipleofonepoint.The-u optionaffect-g(geometry),-t(table)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 digits,12or7characterslong.Stringsof13or8characters areacceptediftheprovidedchecksumdigitiscorrect. Iexpectmostuserstofeedinputwithouta checksum,though.Theadd-2andadd-5extensionareacceptedforboth theEAN-13andtheEAN-8encodings. Thefollowingareexampleofvalidinputstrings: ``123456789012''(EAN-13),``1234567890128''(EAN-13wih checksum),``1234567''(EAN-8),``1234567012345''(EAN-8 withchecksumandadd-5), ``12345678901212''(EAN-13withadd-2), ``12345678901212345''(EAN-13withadd-5).
UPC
TheUPCfrontendacceptsonlystringsmadeupofdigits(and, ifasupplementalencodingisused,ablanktoseparateit). Itacceptsstringsof11or12digits(UPC-A)and6or7or8 digits(UPC-E).

The12thdigitofUPC-Aisthechecksumandisaddedbythe libraryifnotspecifiedintheinput;ifitisspecified,it mustbetherightchecksumorthecodeisrejectedasinvalid. ForUPC-E,6digitareconsideredtobethemiddlepartofthe code,aleading0isassumedandthechecksumisadded; 7digitsareeitherconsideredtheinitialpart(leadingdigit 0or1,checksummissing)orthefinalpart(checksumspecified, leading0assumed);8digitsareconsideredtobethecompletecode, withleading0or1andchecksum. ForbothUPC-AandUPC-E,atrailingstringof2digitsor5digits isacceptedaswell.Therefore,thefollowingareexamples 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). PleasenotethatwhensettingBARCODE_ANYtoauto-detect theencodingtobeused,12-digitstringsand7-digitstrings willalwaysbeidentifiedasEAN.ThisbecauseIexpectmost usertoprovideinputwithoutachecksum.Ifyouneedto specifyUPC-with-checksumasinputyoumustexplicitlyset BARCODE_UPCasaflagoruse-eupconthecommandline.

ISBN
ISBNnumbersareencodedasEAN-13symbols,withanoptional add-5trailer.TheISBNfrontendofthelibraryacceptsreal ISBNnumbersanddealswithanyhyphenand,ifpresent,the ISBNchecksumcharacterbeforeencodingdata.Valid representationsforISBNstringsareforexample: ``1-56592-292-1'',``3-89721-122-X''and``3-89721-122-X 06900}''.
code 128-B
ThisencodingcanrepresentalloftheprintingASCII characters,fromthespace(3)toDEL(1).Thechecksum digitismandatoryinthisencoding.
code 128-C
The``C''variationofCode-128usesCode-128symbolsto representtwodigitsatatime(Code-128ismadeupof104 symbolswhoseinterpretationiscontrolledbythestartsymbol beingused).Code128-Cisthusthemostcompactwayto representanyevennumberofdigits.Theencoderrefusesto dealwithanoddnumberofdigitsbecausethecalleris expectedtoprovideproperpaddingtoanevennumberof digits.(SinceCode-128includescontrolsymbolstoswitch charset,itistheoreticallypossibletorepresenttheodd digitasaCode128-Aor128-Bsymbol,butthistooldoesn't currentlyimplementthisoption).
code 128 raw
Code-128outputrepresentedsymbol-by-symbolintheinput string.Tooverridepartoftheproblemsoutlinedbelowin specifyingcode128symbols,thispseudo-encodingallowsthe usedtospecifyalistofcode128symbolsseparatedby spaces.Eachsymbolisrepresentedbyanumberintherange 0-105.Thelistshouldincludetheleadingcharacter.The checksumandthestopcharacterareautomaticallyaddedbythe library.Mostlikelythispseudo-encodingwillbeusedwith BARCODE_NO_ASCIIandsomeexternalprogramtosupplythe printedtext.
code 39
Thecode-39standardcanencodeuppercaseletters,digits,the blankspace,plus,minus,dot,star,dollar,slash,percent. Anystringthatisonlycomposedofsuchcharactersis acceptedbythecode-39encoder.Toavoidloosinginformation, theencoderrefusestoencodemixed-casestrings(alowercase stringisnonethelessacceptedasashortcut,butisencoded asuppercase).
interleaved 2 of 5
Thisencodingcanonlyrepresentanevennumberofdigits (odddigitsarerepresentedbybars,andevendigitsbythe interleavingspaces).Thenamestressesthefactthattwo ofthefiveitems(barsorspaces)allocatedtoeachsymbol arewide,whiletherestarenarrow.Thechecksumdigitis optional(canbedisabledviaBARCODE_NO_CHECKSUM). Sincethenumberofdigits,includingthechecksum,mustbeeven, aleadingzeroisinsertedinthestringbeingencodedifneeded (thisisspecificallystatedinthespecsIhaveaccessto).
code 128
AutomaticselectionbetweenalphabetA,BandCoftheCode-128 standard.ThisencodingcanrepresentallASCIIsymbols,from 0(N)to127(DEL),aswellasfourspecialsymbols,named F1,F2,F3,F4.Thesetofsymbolsavailableinthisencoding isnoteasilyrepresentedasinputtothebarcodelibrary, sothefollowingconventionisused.Intheinputstring, whichisaC-languagenull-terminatedstring,theNULchar isrepresentedbythevalue128(0x80,0200)andtheF1-F4characters arerepresentedbythevalues193-196(0xc1-0xc4,0301-0304). Thevalueshavebeenchosentoeasetheirrepresentationas escapesequences.

Sincetheshelldoesn'tseemtointerpretescapesequencesonthe commandline,the"-b"optioncannotbeeasilyusedtodesignate thestringstobeencoded.Asaworkaroundyoucanresort tothecommandecho,eitherwithinback-ticksorused separatelytocreateafilethatisthenfedtothestandard-input ofbarcode--assumingyourechocommandprocessesescape sequences.Thenewlinecharacterisespeciallythoughtoencode (butnotimpossibleunlessyouuseacshvariant.

Theseproblemsonlyapplytothecommand-linetool;theuseof libraryfunctionsdoesn'tgiveanyproblem.Inneeded,youcan usethe``code128raw''pseudo-encodingtorepresent code128symbolsbytheirnumericalvalue.Thisencodingis usedlateintheauto-selectionmechanismbecause(almost)any inputstringcanberepresentedusingcode128.

Codabar
Codabarcanencodethetendigitsandafewspecialsymbols (minus,plus,dollar,colon,bar,dot).Thecharacters ``A'',``B'',``C''and``D''areusedto representfourdifferentstart/stopcharacters.Theinput stringtothebarcodelibrarycanincludethestartandstop charactersornotincludethem(inwhichcase``A''is usedasstartand``B''asstop).Startandstop charactersintheinputstringcanbeeitheralllowercaseor alluppercaseandarealwaysprintedasuppercase.
Plessey
Plesseybarcodescanencodeallthehexadecimal digits.Alphabeticdigitsintheinputstringmusteitherbe alllowercaseoralluppercase.Theoutputtextisalways uppercase.
MSI
MSIcanonlyencodethedecimaldigits.Whilethestandard specifieseitheroneortwocheckdigits,thecurrent implementationinthislibraryonlygeneratesonecheckdigit.
code 93
Thecode-93standardcannativelyencode48differentcharacters, includinguppercaseletters,digits,theblankspace,plus,minus, dot,star,dollar,slash,percent,aswellasfivespecial characters:astart/stopdelimiterandfour"shiftcharacters"used forextendedencoding.Usingthis"extendedencoding"method,any standard7-bitASCIIcharactercanbeencoded,butittakesuptwo symbollengthsinbarcodeifthecharacterisnotnativelysupported (oneofthe48). Theencoderherefullyimplementsthecode93encodingstandard. Anycharactersnativelysupported(A-Z,0-9,".+-/$ encodedassuch-foranyothercharacters(suchaslowercase letters,brackets,parentheses,etc.),theencoderwillrevert toextendedencoding. Asanote,theoptiontoexcludethechecksumwilleliminatethe twomodulo-47checksums(calledCandK)fromthebarcode,butthis probablywillmakeitunreadableby9 Thesechecksumsarespecifiedtobeusedatthefirmwarelevel, andtheirabsencewillbeinterpretedasaninvalidbarcode.

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:

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 "scalable". (Ljet II ?), Also these fonts, when available, have a specified direction, and not all of them are available in both Portrait and Landscape 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 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 compatible.

Tested Printers:

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

AUTHORS

Alessandro Rubini <rubini@gnu.org> (maintainer)

Leonid A. Broukhis <leob@mailcom.com> (several encodings)

Andrea Scopece <a.scopece@tin.it> (PCL output)

LaserJet III, III P, III D, III Si,
LaserJet 4 family LaserJet 5 family LaserJet 6 family Color LaserJet DeskJet 1200 and 1600. 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.