In order to install the component you must start delphi and select:
component -> install packages -> select BPL file.
The new component will appear in your component's palette. It will create a new "tab" called "barcodes".
The TBarcode1D component is a subclass of TGraphicControl and can therefore be placed on any form or container. This is the esiest way to use it , however you can also create an instance of the component by program and then paint the barcode on any canvas object using the paintBarcode() method.
The TBarcode1D component has following properties and methods:
Methods
- paintBarcode(canvas): pains the barcode on the provided canvas.
You can also use the component in order to paint onto an external canvas. For example, in order to create a bitmap file you would use the following code:
var
bmp: TBitmap;
begin
bmp:=TBitmap.create();
bmp.height:=200;
bmp.width:=200;
{use paintBarcode() to paint onto an external Canvas}
barcode.paintBarcode(bmp.Canvas);bmp.saveToFile('barcode.bmp');
end;
Properties
- barType: this is the type of barcode to be used. Valid values are: CODE39 ,CODE39EXT , CODE11 ,INTERLEAVED25, CODABAR , CODE93, CODE93EXT , CODE128 ,EAN128, MSI , MAT25 ,IND25, EAN13 , EAN8 , POSTNET, UPCA and UPCE .
- backColor: background color of the barcode.
- barColor: color of the bars.
- barHeightPixels:: height of the bars in pixels. If this value is 0, it will be calculated using H.
- barpostnetHeightTallBar: height (in pixels) of PostNet's tall bar.
- barpostnetHeightShortBar: height (in pixels) of PostNet's short bar.
- CODABARStartChar: Start character for CODABAR. Valid values are 'A', 'B', 'C' or 'D'.
- CODABARStopChar: Stop character for CODABAR. Valid values are 'A', 'B', 'C' or 'D'.
- code: this is the value to be encoded.
- codeText: text to be displayed with the barcode.
- code128set: set of charaters to be used in code128. Valid values are : code128A (0), code128B (1) and code128C (2).
- checkCharacter : If true the software will calculate the check character automatically.
- Font: font used to display the code.
- guardBars: indicates if guardbars will be height than other bars. Only for EAN and UPC.
- H: Indicates how to calculate the height of the bars. A value of 0.5 means that the bars should be half the length of the symbol.
- I: intercharacter separator , only for CODE39. A value of 1 means that the separator will have the same length as X.
- leftMargin: left margin in pixels.
- N: a value of 2, means that wide bars will be 2 times the width of narrow bars. The default vaue is 2.
- processTilde: process the " ~ " in the string to be encoded. The format is ~dNNN where NNN is a value between 0 and 255.
- supHeight: relative height of the supplement's bars (only EAN and UPC). The default (0.8) means 80% of the normal bars.
- supSeparation: separation between the code and the supplement (in pixels). the default is 10(only EAN and UPC).
- supplement: barcode suplement, can be 2 or 5 digits (for EAN and UPC only)..
- topMargin: top margin in pixels.
- textOnTop: if true the text will be place above the barcode.
- UPCEANSupplement2: indicates if the codes EAN and UPC will have a 2 digit's supplement.
- UPCEANSupplement5: indicates if the codes EAN and UPC will have a 5 digit's supplement.
- UPCESystem: encoding system to be used for UPCE, valid values are '0' and '1'.
- X: width in pixels of narrow bars. The default is 1.
How to use the checkCharacter property:
If you are suppling the code with the check digit already calculated, you must set checkCharacter to false (this is the default). If you want the software to calculate the checksum for you, you must set barcheckCharacter to true.For EAN and UPC have fixed length and therefore you only have the following possibilities:
- EAN13: you supply a 13 digits code and set barcheckCharacter to false or you supply a 12 digits code and set barcheckCharacter to true.
- EAN8: you supply a 8 digits code and set barcheckCharacter to false or you supply a 7 digits code and set barcheckCharacter to true.
- UPCA and UPCE: you supply a 12 digits code and set barcheckCharacter to false or you supply a 11digits code and set barcheckCharacter to true.