(TBarcode2D_PDF417)
Returns the check sum of a barcode text that will be encoded into each symbol in a Macro PDF417 set.
type
{ Defined in the pPDF417Com unit }
TPDF417_Option = (poIgnoreShiftBeforeECI, poFirst903TextAlphaLatch, poFirst904TextMixedLatch, po906TextAlphaLatch, po907TextAlphaLatch, po908TextAlphaLatch, po910TextAlphaLatch, po912TextAlphaLatch, po914TextAlphaLatch, po915TextAlphaLatch, poFirstFNC1MatchAI01, poMicroPDF417Explicit901);
{ Defined in the pPDF417Com unit }
TPDF417_Options = set of TPDF417_Option;
function GetCheckSum(Barcode: string; AllowEscape: Boolean; var InvalidIndex: Integer; Options: TPDF417_Options = []): string; virtual;
The method returns the check sum of a barcode text that will be encoded into a Macro PDF417 set. The value will be used in the macro PDF417 control information block, and the macro PDF417 control information block will be used by each symbol in the Macro PDF417 set. See also the "Macro PDF417" section in the "TBarcode2D_PDF417" article.
Barcode: string; It's the original input text before division into the each symbol in the Macro PDF417 set. It is of type string.
For Delphi/C++ Builder 2007 or early, the Barcode parameter is in fact an AnsiString. By default, it is an ANSI encoding string, 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 parameter. Also you can use the method to caculate the check sum of a block of binary (bytes) data.
For 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 caculate its check sum. 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 GetCheckSum (Syntax 2) overloading method and specify the converted string 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.
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 "TBarcode2D_PDF417" 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, the index 1 denotes that the first character is invalid character. Otherwise, it returns the zero.
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 format. And the InvalidIndex parameter returns zero. If the method fails, the InvalidIndex parameter returns a position index of first invalid character, it's an integer value greater than 0.
The result string can be directly used as the check sum in the Macro PDF417 control information block. For example:
var
full_barcode, check_sum, macro_block: string;
invalid_index: integer;
begin
full_barcode := '......';
check_sum := GetCheckSum(full_barcode, false, invalid_index, []);
if invalid_index > 0 then exit;
macro_block := '\s[1,001287023,,5,2008-12-03 05:30:00,,USA,,' + check_sum + ']';
//.....
See also the "Macro PDF417" section in the "TBarcode2D_PDF417" article.