Method: GetCheckSum - Syntax 2

(TBarcodeFmx2D_PDF417)

Returns the check sum of a barcode text that will be encoded into each symbol in a Macro PDF417 set.

Syntax:

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;

function GetCheckSum(Data: TBytes; AllowEscape: Boolean; var InvalidIndex: Integer; Options: TPDF417_Options = []): TBytes; virtual;

Description:

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 "TBarcodeFmx2D_PDF417" article.

Parameters:
Return:

If the method succeeds, it returns the check sum value, it's a 16-bit word value in decimal format, encoded as ASCII bytes sequence, in the TBytes array. And the InvalidIndex parameter returns the Verify_OK (-1). If the method fails, the InvalidIndex parameter returns a position index of first invalid byte in the Data parameter, it's an integer value greater than or equal to zero. See also the InvalidIndex parameter section above.

For example, the check sum is 1059, the return value is the byte array (TBytes):

($31{'1'}, $30{'0'}, $35{'5'}, $39{'9'})

The result array can be directly used as the check sum in the Macro PDF417 control information block:

var

full_barcode_data, check_sum, macro_block: TBytes;

invalid_index: Integer;

macro_block_len, check_sum_len: Integer;

begin

full_barcode_data := ......;

check_sum := GetCheckSum(full_barcode_data, False, invalid_index, []);

if invalid_index <> -1 then exit;

SetLength(macro_block, 15);

macro_block[0] := $5c{'\'};

macro_block[1] := $73{'s'};

macro_block[2] := $5b{'['};

macro_block[3] := $35{'5'};

macro_block[4] := $2c{','}; // Index: 5

macro_block[5] := $30{'0'};

macro_block[6] := $32{'2'};

macro_block[7] := $39{'9'};

macro_block[8] := $2c{','}; // File_ID: 029

macro_block[9] := $2c{','}; // File_Name:

macro_block[10] := $2c{','}; // Amount:

macro_block[11] := $2c{','}; // Time_Stamp:

macro_block[12] := $2c{','}; // Sender:

macro_block[13] := $2c{','}; // Address:

macro_block[14] := $2c{','}; // File_Size:

macro_block_len := Length(macro_block);

check_sum_len := Length(check_sum);

SetLength(macro_block, macro_block_len + check_sum_len + 1);

Move(PByte(@check_sum[0])^, PByte(@macro_block[macro_block_len])^, check_sum_len);

macro_block[macro_block_len + check_sum_len] := $5d{']'};

//......

See also the "Macro PDF417" section in the "TBarcodeFmx2D_PDF417" article.

Contents