(TBarcodeFmx2D_MicroPDF417)
Returns the check sum of a barcode text that will be encoded into a series of structured append symbols.
type
{ Defined in the pfmxPDF417Com unit }
TPDF417_Option = (poIgnoreShiftBeforeECI, poFirst903TextAlphaLatch, poFirst904TextMixedLatch, po906TextAlphaLatch, po907TextAlphaLatch, po908TextAlphaLatch, po910TextAlphaLatch, po912TextAlphaLatch, po914TextAlphaLatch, po915TextAlphaLatch, poFirstFNC1MatchAI01, poMicroPDF417Explicit901);
{ Defined in the pfmxPDF417Com unit }
TPDF417_Options = set of TPDF417_Option;
{ Defined in the pfmxMicroPDF417 unit }
TMicroPDF417_Options = TPDF417_Options;
function GetCheckSum(Barcode: string; AllowEscape: Boolean; var InvalidIndex: Integer; Options: TMicroPDF417_Options = []): string; virtual;
The method returns the check sum of a barcode text that will be encoded into a series of MicroPDF417 structured append symbols. The value will be used in the structured append block, and the structured append block will be used by each symbol in the series of MicroPDF417 structured append symbols. See also the "Structured append" section in the "TBarcodeFmx2D_MicroPDF417" article.
Barcode: string; It's the original input text before division into the each symbol in the series of structured append symbols. It is of type string, and it is in fact an UnicodeString. By default, the unicode string will be converted to an UTF-8 bytes sequence (the BOM isn't included), then caculate its check sum. If you want to use other encoding scheme (for example the ANSI, UTF-16), please convert it in the OnEncode event handle, or use the GetCheckSum (Syntax 2) overloading method and specify the converted bytes sequence in its Data parameter. If you want to caculate the check sum of a block of binary (bytes) data, please use the GetCheckSum (Syntax 2) overloading method.
See also the "Barcode" property article.
AllowEscape: Boolean; Specifies whether to allow users to insert the escape sequences to the Barcode parameter value, in order to place the function characters and additional control information.
See also the "Escape sequences" section in the "TBarcodeFmx2D_MicroPDF417" article and the "AllowEscape" property article.
InvalidIndex: Integer; If there is any invalid character in the barcode text that is specified by the Barcode parameter, the parameter returns the position index of first invalid character. Otherwise, it returns the Verify_OK (-1).
This method can return one of these values (these consts are defined in the pfmxCore2D unit):
Verify_InvalidIndex_AfterBarcode (-4):
If you use the OnEncode event handle to encode the barcode text to a bytes sequence in your own encoding scheme, the Verify_InvalidIndex_AfterBarcode (-4) indicats that an invalid byte value is in the suffix codes of the bytes sequence.
Verify_InvalidIndex_BeforeBarcode (-3):
If you use the OnEncode event handle to encode the barcode text to a bytes sequence in your own encoding scheme, the Verify_InvalidIndex_BeforeBarcode (-3) indicats that an invalid byte value is in the prefix codes of the bytes sequence (for example the BOM).
Verify_OK (-1):
It indicates the method succeeds.
Verify_InvalidIndex_Base (0), and greater than 0:
It indicates that an invalid character is in the barcode text, the return value is the position index of the invalid charactere. For 32-bit Windows, 64-bit Windows, and Mac OSX platform, the index 1 denotes that the first character is invalid character. For iOS and Android platform, the index 0 denotes that the first character is invalid character.
Options: TPDF417_Options; The Options parameter is an advanced feature which allows low level control over data encoding. The parameter can be used to change the encoding algorithm and meanings of some fucntion codewords, in order to match the reader. The values that can be included in the Options parameter are defined in the pPDF417Com unit.
See also the "Options" property article.
If the method succeeds, it returns the check sum value, it's a 16-bit word value, in decimal string (UnicodeString) format, and the InvalidIndex parameter returns Verify_OK (-1). If the method fails, the InvalidIndex parameter returns a position index of first invalid character in the Barcode parameter. See also the InvalidIndex parameter section above.
The result string can be directly used as the check sum in the structured append block. For example:
var
full_barcode, check_sum, structuredappend_block: string;
invalid_index: Integer;
begin
full_barcode := '......';
check_sum := GetCheckSum(full_barcode, False, invalid_index, []);
if invalid_index <> -1 then exit;
structuredappend_block := '\s[1,001287023,,5,2008-12-03 05:30:00,,USA,,' + check_sum + ']';
//.....
See also the "Sturctured append" section in the "TBarcodeFmx2D_MicroPDF417" article.