Bar code parameter defaults, Determining the width of bar code bit maps – AMT Datasouth PAL User Manual
Page 206

200
PAL Language Reference
To take control of the bar code dimensions, you must work in dots instead of points, inches, or mil-
limeters. Doing this will, however, reduce the portability of your PAL programs. The following
PAL program will produce narrow bars exactly 2 dots wide with a ratio of 2.5:1 on an 8 dots/mm
printer. Narrow bars will be 0.0099" (0.250 mm) wide and the wide bars will be 0.0246" (0.6256
mm) wide.
/dots {203 div 72 mul} bind def
/bar {
<<
/NarrowWidth 2
/WideRatio 2.5
/CheckDigit true
>>
/Code39 _barcode
} bind def
72 72 moveto
(CODE39) bar
showpage
The dots procedure converts dots for an 8 dot/mm print density to points.
Bar Code Parameter Defaults
In the discussion of the individual bar code commands, default values for various parameters were
given. All dimensioned values had a parenthetical note giving the dimensions in inches for the de-
fault current transformation matrix (CTM). You should note that these numbers are invariant with
respect to the transformation matrix. This means that if the default for a given dimension is used,
you will only get the expected results if the user units are points. If, for instance, Height is set to
36, the bar code will be 0.5 inches high using the default CTM. If, however, you have scaled the
user units so that you are working in inches, the Height is still 36. Now, however, it will be 36
inches, making a very tall bar code.
There are several solutions to this problem. The easiest solutions are
1) always work in points (don't change the CTM) or
2) explicitly specify all the bar code dimensions, thus overriding the defaults.
A handy way to work in points, but still be able to specify individual dimensions in inches or milli-
meters, is to define simple procedures to locally convert the dimensions. The following example
will specify the height of a Code-128 bar code in millimeters, place the bar code at a specific loca-
tion in inches, and use the default value for NarrowWidth.
/inches {72 mul} bind def
/mm {25.4 div 72 mul} bind def
1.0 inches 1.5 inches moveto
(~bCode-128) <> /Code128 _barcode
showpage
Determining the Width of Bar Code Bit Maps
It is sometimes necessary to compute the width of the bit map generated by the _barcode func-
tion. The following formulas will allow you to estimate this width. For the greatest precision, the
calculations should be done in dots (see discussion above).