ValidateAttachmentChecksum

Document properties, Extraction

Description

Decodes an enumerated attachment payload on demand, computes its MD5 digest, and compares it with the hexadecimal /Params /CheckSum value reported by EnumAttachments

Syntax

Delphi

Function TPDFlib.ValidateAttachmentChecksum(Const Attachment: TPDFlibAttachment): Integer;

Parameters

AttachmentA record returned by EnumAttachments

Return values

1The decoded payload matches the stored checksum
0The payload does not match the stored checksum
-1No checksum is present, the record is out of range, or the payload cannot be read

Remarks

Checksum validation is explicit so metadata-only enumeration does not read and hash large attachment payloads

New attachments created from files or byte strings receive a checksum automatically

See also

EnumAttachments, TPDFlibAttachment, GetEmbeddedFileContentToStream