DrawBarcodeA
Vector graphics, Barcodes
Description
The trailing A denotes the ANSI (char) DLL entry point; the ActiveX/COM surface exposes only the Unicode form. Behaviour is identical to DrawBarcode and string arguments are interpreted using the current SetAnsiMode code page
Draws a barcode on the selected page
For Code128, the barcode is a combination of the "B" and "C" character sets resulting in the most compact representation
GS1-128 barcodes (also known as EAN-128) can be drawn by setting the Barcode parameter to 3 (Code128) and using the string "[FNC1]" or the ASCII GS character (#29) in the appropriate place. For example:
"[FNC1]21ABC123[FNC1]2013"
The previous example indicates a serial number (AI 21) of "ABC123" and a product variant (AI 20) of "13".
Syntax
Delphi
Function DLDrawBarcodeA(InstanceID: Integer; Left, Top, Width, Height: Double; Text: PAnsiChar; Barcode, Options: Integer): Integer;
DLL
int DLDrawBarcodeA(int InstanceID, double Left, double Top, double Width, double Height, const char* Text, int Barcode, int Options);
Parameters
| Left | Horizontal co-ordinate of left edge of the barcode |
|---|---|
| Top | Vertical co-ordinate of top edge of the barcode |
| Width | Width of the barcode |
| Height | Height of the barcode |
| Text | The barcode data. The barcode can be rotated by appending the following to the barcode data string: /RC = Rotate clockwise /RA = Rotate anti-clockwise /RU = Rotate 180 degrees |
| Barcode | 1 = Code39 (or Code 3 of 9) 2 = EAN-13 3 = Code128 4 = PostNet 5 = Interleaved 2 of 5 |
| Options | Code39: 0 = Default drawing EAN-13: 0 = Only draw the barcode 1 = Extend the guard bars 2 = Draw the human-readable numbers 3 = Draw the human-readable numbers, with right spacer Code128: 0 = Default drawing PostNet: 0 = Default drawing Interleaved 2 of 5: 0 = Do not add a checksum, no bearer bars 1 = Add a checksum character, no bearer bars 2 = Do not add a checksum, draw bearer bars 3 = Add a checksum character, draw bearer bars To apply 10% bar width reduction to the barcode, increase the value of the Options parameter by 10 |
Type 10 draws Codabar (BS EN 798): the text must open and close with one of the start/stop letters A B C D and the body may contain digits and the symbols - $ : / . +; the symbol uses rationalised encoding with 3-module wide elements
Type 9 draws UPC-E: pass the six data digits, with fewer digits zero-padded on the left, or the full eight-digit form consisting of number system 0, the six data digits and the check digit, which is verified; characters other than digits are ignored, and any other digit count, another number system or a wrong check digit makes the call return 0
Return values
| 0 | The barcode could not be drawn. Invalid Barcode or Options parameters |
|---|---|
| 1 | The barcode was drawn successfully |