|
|
|||||||||
|
|
|
|
|
|
|||||
|
FAQ The Softek Barcode Toolkit reads barcodes from images. |
Code 39 and Code 25 work best because they only have 2 widths of bar.
The main requirement is for each black or white bar in a barcode to be clearly visible on the image. All barcodes have at least 2 sizes of bar and the image needs to be of high enough quality to show this. For example, a Code 39 barcode consists of 9 bars per character, of which 3 must be wide and 6 must be narrow. The wide bars should be around 2.5 times the size of the narrow bars - but for simplicity we will say 2 times the size. This means that each character needs at least 12 pixels in an image. This assumes that each pixel in the image lies either entirely in a black bar or entirely in a white bar. In practise, this isn't possible and so the resolution should allow around 36 pixels per character. So, to encode a string of 10 characters (including the start and stop *) you will need at around 360 pixels. If the barcode is 1 inch wide on the paper then you will need to scan at a resolution of around 400 DPI. If the barcode is 2 inches wide then you will need to scan at a resolution of at least 200 DPI. Some types of barcode have more than 2 widths of bar and a higher resolution still will be needed to ensure that the different widths can be distinguished on the image. As for barcode height - if you have a very wide barcode then you need to ensure that it is high enough to cope with any skewing that takes place when the image is scanned. In summary - the success of a project can depend on specifying the correct barcode size and image resolution.
When packaging up the toolkit with your software you need to include the following files and install them into the windows system folder: If you are using the standard windows DLL then you will need:
If you are using the COM interface then you will also need SoftekATL.dll and msvcr70.dll If you are using the OCX/ActiveX interface then you will also need SoftekBarcode.ocx If you are using the .Net component then you only need either the file SoftekBarcodeLib.dll or SoftekBarcodeLib2.dll
The only files that need to be registered are SoftekBarcode.ocx and
SoftekATL.dll with a command such as:
Properties:
Methods:
The following code example shows how an image loaded with the LeadTools Main OCX can be scanned for barcodes with the Softek Barcode OCX. This code can be easily adapted for use with DLL functions: m_LeadToolsMain.Load("s:\\tmp\\file.tif", 0, 0, -1) ;
Code 39 barcodes often include a checksum character, which is not usually printed under the barcode. There is no way for the toolkit to determine whether the last character is a checksum or just part of the barcode string - and so all the characters are included in the string returned to the calling application. The checksum for Code 39 barcodes is usually a mod-43 checksum worked out as follows: Each character in the symbol set has a value. 0 = 0, 1 = 1,...., 9 = 9, A = 10,......, Z = 35, - = 36, . = 37, space = 38, $ = 39, / = 40, + = 41, % = 42. Sum the values of the characters and take the remainder on division by 43. This is the value of the checksum.
By default the barcode toolkit returns as soon as it finds the first barcode in an image. To read more than one barcode from an image you need to set the MultipleRead property to True or to call the bardecode command with the -m option.
Windows developers can use the Softek Barcode Toolkit for Windows PDF Extension. Linux developers can use Ghostscript to convert the PDF document to TIF before calling the Softek Barcode Toolkit to read the barcode:
gs -r300 -dNOPAUSE -q -sPAPERSIZE=a4 -sDEVICE=tiffg3 -sOutputFile=file.tif --
file.pdf
Have you put the start and stop * characters around the barcode? If you want to create a Code 39 barcode for the string "ABCDE" then you need to type "*ABCDE*". IMPORTANT: MS Word has a feature that automatically converts any text surrounded by * characters into bold. If this feature is enabled then your barcodes will not work. To disable this feature you will have to select Autoformat from the Tools menu and un-tick the "*Bold* and _Italic_ with real formatting" option on the "Autoformat as you type" tab.
Hylafax calls a script called faxrcvd every time a fax is received. You can read the barcode from the image by inserting a line such as: barcode=`/path_to_barcode_command/bardecode -t any -j 1 -f $qfile` For more information on the faxrcvd script please use the following link on the Hylafax web site: http://www.hylafax.org/man/faxrcvd.html
The following function for reading barcodes from a memory bitmap is available in the bardecode.a library: int STReadBarCodeFromBitmap(void *hBarcode, BITMAP *pBitmap, float resolution, char ***bc, char ***bc_type, short photometric)
Where:
Return Value:
BITMAP Structure:
typedef struct tagBITMAP {
int bmType;
int bmWidth;
int bmHeight;
int bmWidthBytes;
BYTE bmPlanes;
BYTE bmBitsPixel;
LPVOID bmBits;
} BITMAP;
|
| © 1998-2008 Softek Software Ltd. All rights reserved. |