[barcode] Deciphering command line options
Alessandro Rubini
rubini@linux.it
Thu Jun 18 10:20:23 CEST 2009
Hello.
Sorry for the delay
I've added a grid to the page in order to check what's happening.
A ticker line every cm and a thinner line every 2mm.
Maybe it's useful to you as well:
cat > a4grid << END
% conversion to mm
/mm {72.0 mul 25.4 div} def
% write a grid
.8 .8 .8 setrgbcolor
.3 mm setlinewidth
0 10 210 {
mm 0 mm moveto 0 mm 297 mm rlineto stroke
} for
0 10 297 {
mm 0 mm exch moveto 210 mm 0 mm rlineto stroke
} for
.1 mm setlinewidth
0 2 210 {
mm 0 mm moveto 0 mm 297 mm rlineto stroke
} for
0 2 297 {
mm 0 mm exch moveto 210 mm 0 mm rlineto stroke
} for
END
cat > dogrid << END
#!/usr/bin/gawk -f
/showpage/ {while (getline < "a4grid") print; print "showpage"; next}
{print}
END
chmod +x dogrid
So now I can
seq 100001 100045 | barcode $args | ./dogrip > /tmp/psout
Let's recap what was suggested:
>> horizonally: 0 out-of-table margine and 7mm internal margin
>> vertically: 13.5 out-of-table and 1.5 internal:
>>
>> barcode -e code39 -c -u 'mm' -p 210x297 -t 3x15+0+13.5 -m 7,1.5
Results:
> - vertically, it looks pretty good (probably the best I've ever seen
> yet): 14mm margin top/bottom of page, 15mm high barcode and 3mm
> vertical gap between label rows.
Yes.
> If I had to make any complaint, is that the printed text
> representation of the barcode extends below the bottom edge of the code,
Well, probably the "printed text" stuff is slightly bugged wrt font
dimension. If I try with "-n" things are exactly as expected.
> - horizontally though it's way off line. Rows appear to print as:
> 5mm [56mm label]13mm [56mm label]13mm [56mm label]7mm
Actually, I see 7mm on both sides. No problem.
The requested layout was:
14mm [51mm label] 14mm [51mm label] 14mm [51mm label] 14mm
So my command line was wrong. We need an external margin of 7mm:
./barcode -e code39 -c -u 'mm' -n -p 210x297 -t 3x15+7+13.5 -m 7,1.5
Actually, with my grid and gv I see 7 mm on each side. This works for me.
> I still don't follow how you arrived at the margin values you
> suggested, but I'll play around with it today & see what I can come
> up with.
The idea is that you have rectangular stickers with an external border.
Therefore, with spaces added for readability:
-t ncol x nrow + xmargin + ymargin [ - xmargin - ymargin ]
Then, each sticker has internal borders.
I got the +X+Y and -X-Y syntax from the "-geometry" argument of X applications,
although there you specify either one and never both.
In this case, you have 7mm internal X margin in each sticker, which results
in 14mm of separation of the printouts. Externally, you need to add 7mm
on each side.
Vertically, the 3mm separation means 1.5mm internal border. To reach the
15mm you need on top and bottom, you need to add 13.5 mm more.
So the idea is: define the printable area as a "ncol x nrow" grid with
external margines before the page border is reached. Then, internally
to each sticker, you set "imargins" to place the printout.
When I've done that, I just measured the sticker-page I bought and it
worked painless (since I designed the arguments according to my specific
need, thinking it would be the general use in printing pages of codes.
> The reason I was using -g in the first place is because the doco
> suggests that that's how it should be used:
I should definitely make the docs clearer. When I get the new png-output
patch I'll fix this as well to make a release.
[from your other message]
> - Horizontally it's still a mess. Using -t 3x15+0+13.5 -m 7,1.5 has
> the following effect
>
> LH margin appears to be about 5mm
> RH margin appears to be about 7mm
The difference should depend on paper placement in the printer. On-screen
it looks symmetrical (ever checking with the grid).
The 12mm internal should actually be 14mm. Ink spreading effects or
a bug in the program?
> [...] as that would give 1mm whitespace each end to the label cut mark).
Hmm... most likely you need more margin for a reader to be able to parse it.
> So I'm a bit lost as to what to try next.
Please tell me if this description and the grid hack help finding the
solution. Or if there's a bug in the code, I'll look for it.
/alessandro
More information about the barcode
mailing list