The following example demonstrates use of ClearImage COM with Delphi. For additional guidelines and more code examples see this Application Note.
Barcode Recognition in Delphi | ![]() |
---|---|
uses ClearImage_TLB,comobj,... ...... functionDecodeBarcode(constaFileName:string):AnsiString var Ci:ICiServer Image:ICiImage Barcode:ICiBarcodePro begin Result:='' try try begin Ci:=CoCiServer.Create //Open image Image:=Ci.CreateImage Image.Open(aFileName,1) //Create Barcode recognition object Barcode:=Ci.CreateBarcodePro Barcode.Image:=Image Barcode.Type_:=cibCode39 //To automatically detect barcode type //Barcode.AutoDetect1D:=ciTrue //Read one barcode.To find all barcodes call Barcode.Find(0) Barcode.Find(1) if Barcode.Barcodes.Count>0 then Result:=Barcode.Barcodes.Item[1].Text end except //Process errors on E:Exception doShowMessage(Format('Error:s.File:s', [E.Message,FileName])) else ShowMessage('UnknownError') end finally end end |