Working with Barcode (Part I)

For couple days, I’ve been playing around with barcode tool to support my existing project software development. This become my new experience about how to create the schematic image from several type of barcode and finally pick one to implementing on my Delphi form projects.



Let me introduce to the barcode reader hardware first. The reader comes with a straight PS/2 port compatible to USB cables extension. It has made from Taiwan with serial code 1000 CCD mode from CipherLab 1300. The sensor are quite accurate and support the most known barcode types such as Code39, Italian Pharmacode, French Pharmacode, Industrial 25, Interleave 25, Matrix 25, Codabar, Code93, Code128, UPCE, EAN8, EAN13, MSI, Plessey and PDF417.

Before getting it done, I had to create a small card-name size which typed a tiny barcode image consists 9 digits of number somewhere on it in one of my modules. So, smallest possible barcode image would be nice to paint on the front side of the card. The next question is, what type of barcode I have to choose?

From third party tool application got from internet (shmia@bizerba.de), I had analyzed several barcode images priorities on the length size and sort it in order to fit in the card form I described before. And below is the result :


CodeUPC_Supp2 (Unable to read)

CodeUPC_E0 (Unable to read)

Code_2_5_interleaved

Code_2_5_matrix

Code128C

CodeEAN13

CodeCodabar

Code_2_5_industrial

Code93

Code128A

CodeMSI

Code39

CodePostNet

CodeEAN128A

From the result above, I surely my mind to choose the Interleave 25 barcode type. It has less length and still able detected by the reader hardware. The module I developed, require no external font installed on Windows since the TBarcode (TasBarcode) component create the image by it self.
procedure TForm1.FormCreate(Sender: TObject);
begin
{
Create a barcode object.
this object is freed when the form is going to destroyed, because it is owned
by the form (self parameter)
}
Barcode1 := TAsBarcode.Create(self);
Barcode1.Top := 50;
Barcode1.Left := 30;
Barcode1.Typ := bcCodePostNet;
Barcode1.Modul := 2;
Barcode1.Ratio := 2.0;
Barcode1.Height := 50;

Barcode1.OnChange := Self.Barcode1Change;

ComboBox2.ItemIndex := integer(Barcode1.ShowText);
end;
procedure TForm1.print_demo(bc:TAsBarcode); var tmpbarcode : TAsBarcode; begin { create a temp barcode object, because we want to change some properties } tmpbarcode := TAsBarcode.Create(nil); { copy the object } tmpbarcode.Assign(bc); try with printer do begin BeginDoc; { Height of barcode: 40mm } tmpbarcode.Height := ConvertMmToPixelsY(40.0); tmpbarcode.Height := ConvertInchToPixelsY(1.5); { Modulwidth: 0.5mm } tmpbarcode.Modul := ConvertMmToPixelsX(0.5); tmpbarcode.Top := ConvertMmToPixelsY(100.0); tmpbarcode.Left := ConvertMmToPixelsX(35.0); tmpbarcode.DrawBarcode(Canvas); EndDoc; end; finally tmpbarcode.Free; end; end;
This article will continued...

Labels:


PS: If you've benefit from this blog,
you can support it by making a small contribution.

Enter your email address to receive feed update from this blog:

Post a Comment

 

Post a Comment

Leave comments here...