[barcode] Deciphering command line options

Brendon Oliver brendon.oliver@gmail.com
Tue Jun 16 23:01:34 CEST 2009


Hi Alessandro,

On Tue, 16 Jun 2009 07:16:44 pm Alessandro Rubini wrote:

Thanks for your reply...

> From my reading of the code (which I wrote ages ago), I find that
>
> -g sets code_width, code_hegith, xmargin0, ymargin0
> -t sets xmargin0, ymargin0, xmargin1, ymargin1
> -m sets ximargin, yimargin (internal margins)
>
> Note both -g (meant for single-bar-per-page) and -t (meant for page of
> bars) set xmargin0 and ymargin0. The latter is the one that counts,
> but it's better not to use -g for a table.
>
> Then, we have xstep and ystep like this:
>
>         int xstep = (page_wid - xmargin0 - xmargin1)/columns;
>         int ystep = (page_hei - ymargin0 - ymargin1)/lines;
>
> And a print instruction in the loop, for [xy] starting from 0:
>
> 	Barcode_Position(bc, code_width, code_height,
>                         xmargin0 + ximargin + x * xstep,
>                         ymargin0 + yimargin + y * ystep, 0.0) < 0)
>
>
> So I think you need to discard -g, use internal margines (-m) to set
> borders in each sticker and use -t alone to set the table. I've made some
> tests with gv and it seems to work as advertised.
>
> So let's see from your data that I repeat here:
> > So we have horizontally:
> > 14mm [51mm label] 14mm [51mm label] 14mm [51mm label] 14mm
> >
> > Vertically:
> > 15mm (top margin)
> > [15mm label]
> > 3mm
> > ... repeat x14 rows...
> > 15mm (bottom margin)
>
> 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
>
> I tried with "seq 100001 100045" piped to barcode as above and it looks
> good.

As a starting point, I took your above command options verbatim:

- 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.  If I had to make any complaint, is that the printed text 
representation of the barcode extends below the bottom edge of the code, so 
when this is printed on the real label sheets, the text will be cut off the 
label to some degree, but we can probably live with that;
- horizontally though it's way off line.  Rows appear to print as:
	5mm [56mm label]13mm [56mm label]13mm [56mm label]7mm

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 reason I was using -g in the first place is because the doco suggests that 
that's how it should be used:

`-t table-geometry'
...."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."...

To me, it suggests that -t gives the row x col dimensions of the table, the 
margin options there being the left/right/top/bottom margins of the overall 
page, and -g is the size of the label cell, optionally with an internal margin 
for each cell.

Many thanks for your suggestions,

- Brendon

-- 

 06:44:18 up 5 days, 20:15,  8 users,  load average: 0.41, 1.21, 1.51




More information about the barcode mailing list