barcode problem

289 views
Skip to first unread message

Koshal Agarwal

unread,
Jan 27, 2017, 2:14:30 AM1/27/17
to Harbour Users
Hi all 
I am printing bar code , bar code prints and looks OK but bar code reader is not able to read them 
I have changed many bar code fonts but failed , pls help me on this issue or suggest bar code font which works properly .
should i have to add some code before printing bar code ?

koshal
 

Gale Ford

unread,
Jan 27, 2017, 11:44:34 AM1/27/17
to Harbour Users
Don't forget to use an asterisk before and after text.
cMyString := "test"
cBarcodeText := "*"+cMyString+"*"
// Now the variable cBarcodeText contains valid string to print.

Klas Engwall

unread,
Jan 27, 2017, 1:52:41 PM1/27/17
to harbou...@googlegroups.com
Hi Koshal,

> I am printing bar code , bar code prints and looks OK

How do you determine that it "looks OK"? Have you checked the result
against existing barcodes sing the same data?

> but bar code reader is not able to read them
> I have changed many bar code fonts but failed , pls help me on this
> issue or suggest bar code font which works properly .

It is not that the fonts you use are not working properly, it is the
data you send to the printing routine that is not correct. And the
internals of the font must match the type of barcode you want to print.

> should i have to add some code before printing bar code ?

The short answer is yes. But what you have to add depends on the type of
barcode you want to print. The preparations for creating barcoeds in
general range from simple to extremely complicated, involving
calculating check digits, substituting data using lookup tables, adding
start/stop characters, switching between different code sets, etc.

Gale gave you an example at the simple end of the scale, printing a
CODE39 barcode. For that, just add an asterisk at the beginning and one
at the end, and send the string to a CODE39 barcode font. To print
EAN128 or CODE128 you have to go through many different steps before you
have a valid data string to send to the CODE128 font. All the other
one-dimensional barcodes lie somewhere between those two.

You can find instructions for building the data strings for different
types or barcodes in various places on the web.

Regards,
Klas

Itamar Lins

unread,
Jan 27, 2017, 4:58:37 PM1/27/17
to Harbour Users
Hi!
Readers of barcodes, uses standardized sizes, can not use non-standard size of the readers.
Use label print correct to this.

Best regards,
Itamar M. Lins Jr.

Itamar Lins

unread,
Jan 27, 2017, 5:02:36 PM1/27/17
to Harbour Users


Best regards,
Itamar M. Lins Jr.

Koshal Agarwal

unread,
Jan 28, 2017, 1:34:40 AM1/28/17
to Harbour Users
Thanks Gale, Klas itamar for great help 
    I am able to print and read correctly barcodes in 39 fonts  
 
for 128 i got this code in net
 
 oPrn := win_prn():New(GetDefaultPrinter()) 
 oPrn:SetFont("code128",11,,,,255)  // please try different   value
 oPrn:TextOut("ÑABC!Ó",.t.)   // TEXT ready to TO PRINT
 oPrn:TextOut(code128("ABC"),.t.)   // TEXT TO PRINT IF YOU HAVE CONVERT FUNC
 oPrn:NewPage()
 but i could not find char Ó (capital O with acute) in my ascii chart 
 
with gale's help of adding "*" before and after my text i could successfully migrated my library software from clipper to harbour 
 
koshal
 

Klas Engwall

unread,
Jan 28, 2017, 2:22:25 PM1/28/17
to harbou...@googlegroups.com
Hi Koshal,
About the asterisk, I hope you realize that it is only valid for CODE39.
Every type of barcode has its own method for telling the barcode reader
what type of barcode it is, and the asterisk is the "magic code" that
says this is a CODE39 barcode.

About the sample code from
http://harbourlanguage.blogspot.se/2011/01/understanding-harbour-barcode.html
that you quoted, the Openbarcodes project the page refers to seems to
have both barcode fonts and encoders. The encoder is the necessary first
step in converting your text string to the correct sequence of codes.
But I am not really in a position to comment on the project in question.
The page says that the sample has not been tested ... and I am not sure
if the Openbarcodes encoders can be called directly from Harbour without
a HB_FUNC layer inbetween. Apparently the FoxPro code on that page tries
to take care of that, and it seems to be mostly generic Xbase.

About specific characters, every type of barcode has it limits regarding
the availability of characters outside the 7-bit ASCII range. I don't
know what ASCII chart you are referring to, but for CODE128 I would
suggest that you take a good look at
http://www.barcodeisland.com/code128.phtml which is a good CODE128
reference, and also https://en.wikipedia.org/wiki/Code_128 and the
references at the bottom of the Wikipedia page. Reference #2 talks about
accented and diacritic characters and about umlauts, which to some
extent can be created with the FNC4 special character, but that is not
widely supported, so those characters can be difficult to use, and they
are sure to make life complicated. You may have to abandon at least some
of them. The same goes for most other barcode types too, they were
simply not created to support all characters from all languages.

Regards,
Klas

Klas Engwall

unread,
Jan 28, 2017, 2:35:26 PM1/28/17
to harbou...@googlegroups.com
Hi Koshal,

> Reference #2 talks about
> accented and diacritic characters and about umlauts, which to some
> extent can be created with the FNC4 special character, but that is not
> widely supported, so those characters can be difficult to use, and they
> are sure to make life complicated. You may have to abandon at least some
> of them. The same goes for most other barcode types too, they were
> simply not created to support all characters from all languages.

I should have added that when creating barcodes for other parties to
read, for example barcodes on shipping labels and labels on cartons that
will be handled in warehouses, and so on, the other party will often
have rules regarding which characters they accept in the barcode. So
check that too.

Regards,
Klas

Ulisses

unread,
Jan 30, 2017, 3:29:20 PM1/30/17
to harbou...@googlegroups.com

Hi all,


In fact, barcodes use standard RELATIONS between widths of the bars. (bars and spaces, depending of the type of code).

For the actual widht measured in some readers will vary with the speed of reading. Other readers are not messed by speed, once they read a quick scan of the code. Regardless of the type of reader, you must have a minimum resolution to print the code in order to maintain the relations between widths. When calculating this minimum resolution, add an extra pixel to white bars to compensate the rubbering effect around the black edges. I suppose you are NOT applying white ink on a black surface. If this is the case, add that extra pixel to the black ones.

If you have available space, try to use twice the minimum calculated resolution. This will produce well readable codes.

Just trying to clarify the subject.


Ulisses Bruder Junior
--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Nenhum vírus encontrado nessa mensagem.
Verificado por AVG - www.avg.com
Versão: 2016.0.7998 / Banco de dados de vírus: 4749/13864 - Data de Lançamento: 01/30/17


Reply all
Reply to author
Forward
0 new messages