Page 1 of 1

How generate a barcode code128 via command line?

Posted: 2011-04-29T07:31:48-07:00
by mbelgrano
Im using via command line follow
convert -font code-128 -pointsize 58 -fill black -size 400x100 xc:white -draw "text 20,80 'Ò,BÍ5VÓ'" barcmax.jpg
Print incorrect image of barcode
I am using Use code128 from http://sourceforge.net/projects/openbarcodes/

work right if print "Ò,BÍ5VÓ" via wordpad with "code 128" font selected
"Ò,BÍ5VÓ" is 12345 encoded

Thanks in advace

Re: How generate a barcode code128 via command line?

Posted: 2011-04-29T10:57:43-07:00
by Bonzo
Try this:

Code: Select all

convert -size 400x100 xc:white -font code128.ttf -pointsize 58 -fill black  -draw "text 20,80 'Ò,BÍ5VÓ'" barcmax.jpg
I have created the "canvas" first and put the correct filename of the barcode font.

Re: How generate a barcode code128 via command line?

Posted: 2018-01-23T08:55:02-07:00
by carloskich
In code 128 there is the code '(apostrophe). I'm using the command:

convert -density 600 -size 2000x333 xc:white -font c:\windows\fonts\code128c.ttf -fill black -draw "text 20,333 'úC1,'D$dü!DYüHüNe;3UF'cjû' " C:\Carlos\dacte\test.jpg

The bar code is cutting because of the '

Any suggestion?

Re: How generate a barcode code128 via command line?

Posted: 2018-01-23T10:34:08-07:00
by fmw42
Have you tried using escaping the single quotes as \'.

This works fine for me on IM 6.9.9.23 Q16 Mac OSX

Code: Select all

convert -size 200x200 xc:white -fill black -font arial -pointsize 18 -draw "text 20,20 'abc\'def\'ghi'" tmp.png

Re: How generate a barcode code128 via command line?

Posted: 2018-01-24T05:55:02-07:00
by carloskich
Thank you very much. Now it's 99%.

I still encounter problems running the command:

convert -density 600 -size 1500x333 xc:white -font c:\windows\fonts\code128c.ttf -fill black -draw "text 20,333 'úJ2!\'D$dü#&YüRü+7b-;"P/`û'" c:\carlos\test.jpg

When I run from the command line (DOS) it works perfectly.
But when I run with a BAT file, error occurs.

Re: How generate a barcode code128 via command line?

Posted: 2018-01-24T10:45:14-07:00
by fmw42
Sorry I do not know Windows scripting. Try using Windows escapes ^' rather than \'