Prints a barcode symbol to printer. The barcode symbol is specified in the parameters of this method. Pelase use the method between the Printer.BeginDoc and the Printer.EndDoc methods.
type
{ Defined in the pCore1D unit }
TBarcodeTextDefine = record
DisplayText: TDisplayText;
TextPosition: TTextPosition;
TextAlignment: TTextAlignment;
TextFont: TFont;
ExtraFontSize: Integer;
end;
function Print(Left, Top: Double; Barcode: string; AutoCheckDigit: Boolean; BarColor, SpaceColor: TColor; BarcodeTextDefine: TBarcodeTextDefine; Ratio: Double; Module: Double = 0; BarcodeWidth: Integer = 0; BarcodeHeight: Double = 0; Angle: Integer = 0): Integer; overload; virtual;
Prints a barcode symbol that is specified in the parameters of this method to the printer.
Left: Double; Specifies the margin between the barcode symbol and the left side of the paper in millimeters. If the human readable text is represented, it's included in the barcode symbol.
For TBarcode1D_UPCA, TBarcode1D_UPCE, TBarcode1D_UPCE0, TBarcode1D_UPCE1, TBarcode1D_EAN2, TBarcode1D_EAN5, TBarcode1D_EAN8, and TBarcode1D_EAN13 barcode components, if the human readable text is represented, and the TextAlignment field of the BarcodeTextDefine parameter is set to taCustom, the left and right quiet zones marks and their horizontal spacing are included in the barcode symbol too.
For TBarcode1D_ITF6, TBarcode1D_ITF14, and TBarcode1D_ITF16 barcode components, all bearer bars, the left and right spacing are included in the barcode symbol too.
If the human readable text is represented and it exceeds the barcode symbol in horizontal or vertical direction, the excess is included in the barcode symbol too.
See also the "LeftMargin" property.
Top: Double; Specifies the margin between the barcode symbol and the top side of the paper in millimeters. If the human readable text is represented, it's included in the barcode symbol.
For TBarcode1D_UPCA, TBarcode1D_UPCE, TBarcode1D_UPCE0, TBarcode1D_UPCE1, TBarcode1D_EAN2, TBarcode1D_EAN5, TBarcode1D_EAN8, and TBarcode1D_EAN13 barcode components, if the human readable text is represented, and the TextAlignment field of the BarcodeTextDefine parameter is set to taCustom, the left and right quiet zones marks and their horizontal spacing are included in the barcode symbol too.
For TBarcode1D_ITF6, TBarcode1D_ITF14, and TBarcode1D_ITF16 barcode components, all bearer bars, the left and right spacing are included in the barcode symbol too.
If the human readable text is represented and it exceeds the barcode symbol in horizontal or vertical direction, the excess is included in the barcode symbol too.
See also the "TopMargin" property.
Barcode: String; Specifies the barcode text. It is of type string. For Delphi/C++ Builder 2007 or early, the Barcode parameter is in fact an AnsiString. For Delphi/C++ Builder 2009 or later, it is in fact an UnicodeString instead of AnsiString.
For the TBarcode1D_Code128 and the TBarcode1D_EAN128 components, if you use them in the Delphi/C++ Builder 2007 or early, the Barcode parameter is in fact an AnsiSting in ANSI encoding scheme. If you want to use other encoding scheme (for example the UTF-8, UTF-16), please convert it in the OnEncode event, or specify the converted string in the Barcode paramater. Also, you can use the method to encode a block of binary (bytes) data; If you use them in the Delphi/C++ Builder 2009 or later, it is in fact an UnicodeString instead of AnsiString. By default, the unicode string will be converted to an ANSI encoding string, then be encoded into the barcode symbol. If you want to use other encoding scheme (for example the UTF-8, UTF-16), please convert it in the OnEncode event, or use the Print (Syntax 3) overloading method and specify the converted string in its Data paramater. If you want to encode block of binary (bytes) data, please use the Print (Syntax 3) overloading method. Note, the "\" character is used as a escape prefix, so if you want to encode the "\" character, please use the "\\" instead of it.
For the TBarcode1D_OneCode component, first 20 characters are the Tracking (It is right padded with zeroes to 20 characters), then come the Routing.
For the TBarcode1D_FIM component, it is single character that denotes the FIM type, form "A" to "E", the "E" character dnotes an empty barcode symbol.
For the TBarcode1D_Patch component, it is single character that denotes the Ptach type, and it can be set to "0", "1", "2", "3", "4", "6", and "T", the "0" character dnotes an empty barcode symbol.
For the TBarcode1D_Code32 component, First "A" character does not need to be entered in the parameter. Also, for the TBarcode1D_PZN component, First "PZN" characters do not need to be entered in the parameter.
See also the "Barcode" property.
AutoCheckDigit: Boolean; Specifies whether the check digit should be automatically appended to the barcode symbol.
See also the "AutoCheckDigit" property.
BarColor: TColor; Specifies the color for all bars in the barcode symbol.
See also the "BarColor" property.
SpaceColor: TColor; Specifies the color for all spaces in the barcode symbol.
If the human readable text is represent, the color will be used as its background color (the foreground color is specified using the TextFont field of the BarcodeTextDefine parameter). For TBarcode1D_ITF6, TBarcode1D_ITF14, and TBarcode1D_ITF16 components, the left spacing and the right spacing will be represented using the color. For TBarcode1D_UPCE, TBarcode1D_UPCE0, TBarcode1D_UPCE1, TBarcode1D_UPCA, TBarcode1D_EAN2, TBarcode1D_EAN5, TBarcode1D_EAN8, and TBarcode1D_EAN13 components, if the human readable text is represented, and the TextAlignment field of the BarcodeTextDefine parameter is set to taCustom, the left and right quiet zones, left quietzone spacing and right quiet zone spacing will be represented using the color. In other words, the parameter specify the background color for entire barcode symbol.
See also the "SpaceColor" property.
BarcodeTextDefine: TBarcodeTextDefine; Specifies whether to display the human readable text and how to display the human readable text. The record is defined in the pBarcode1D unit.
See also the TBarcodeTextDefine record.
Ratio: Double; Specifies ratio between a wide bar (or space) and a narrow bar (or space) in the barcode symbol. The normal values are from 2.0 to 3.0. If the parameter is less than or equal to zero, the method fails, and the return value is -2.
See also the "Ratio" property.
Module: Double; Specifies the module width in millimeters, it is the width of the smallest bar (or space) in the barcode symbol.
If the BarcodeWidth parameter is greater than zero, the value in the Module will be ignored, the module value will be calculated based on the BarcodeWidth parameter. If both Module and BarcodeWidth parameters are less than or equal to zero, the BarcodeHeight parameter must be set to greater than zero, the module value will be calculated based on the BarcodeHeight parameter and the Height property.
See also the "Module" property.
Angle: Integer; Specifies an angle in degrees to rotate the barcode symbol. It defaults to 0 if the Angle is not provided, meaning left to right horizontal direction.
BarcodeWidth: Double, Specifies the barcode symbol width before rotation, in millimeters. If the human readable text is displayed and it exceeds the barcode symbol in horizontal direction, the excess isn't included in the width value.
For TBarcode1D_UPCA, TBarcode1D_UPCE, TBarcode1D_UPCE0, TBarcode1D_UPCE1, TBarcode1D_EAN2, TBarcode1D_EAN5, TBarcode1D_EAN8, and TBarcode1D_EAN13 barcode components, if the human readable text is displayed, and the TextAlignment field of the BarcodeTextDefine parameter is set to taCustom, the width of quiet zone marks and their horizontal spacing (LeftQuietZoneSpacing and RightQuietZoneSpacing) are included.
For TBarcode1D_ITF6, TBarcode1D_ITF14, and TBarcode1D_ITF16 barcode components, width of left and right bearer bars (BearerWidth), left spacing, and right spacing are included too.
If the parameter is provided and isn't zero; the value in Module parameter will be ignored, the module width will be calculated based on the BarcodeWidth value. If the parameter isn't provided or it's set to zero, the Module parameter will be used.
See also the "BarcodeWidth" property.
BarcodeHeight: Integer; Specifies the distance between the top and bottom of the barcode symbol before rotation, in millimeters or modules. If the human readable text is displayed, the height of the human readable text and its vertical spacing (TextVSpacing) are included. If it exceeds the barcode symbol in vertical direction, the excess isn't included.
For TBarcode1D_ITF6, TBarcode1D_ITF14, and TBarcode1D_ITF16 barcode components, the height of top and bottom bearer bars are included too.
If the parameter isn't provided or it's set to zero, it will be calculated based on the values of Module parameter and the Height property.
If the parameter is provided and it is not set to zero, the value of Height property will be ignored. If it's greater than zero, it specifies the height in millimeters. If it's less than zero, the absolute value of the parameter specifies the height in modules.
Pelase use the method between Printer.BeginDoc and Printer.EndDoc methods. For example:
Printer.BeginDoc;
... { Print other content }
Barcode1D_Code391.Print(...); { Print the barcode }
... { Print other content }
Printer.EndDoc;
See diagram:
For Delphi 3, the method overload and default value of parameter aren't supported, so the method name is changed to Print2, and the parameters Module, BarcodeWidth, BarcodeHeight, and Angle are required.