SetSigFlags

Security and signatures

Description

Writes the AcroForm /SigFlags byte of the loaded document (ISO 32000-1 Table 218): bit 1 (value 1) is SignaturesExist, meaning the document contains at least one signature field, and bit 2 (value 2) is AppendOnly, meaning the document is certified and viewers should reject any change other than an incremental signature append

The value is stored verbatim in the AcroForm dictionary; a missing /SigFlags entry is created on the fly so the value survives a save. The function requires a document that already has form data

Syntax

Delphi

Function TPDFlib.SetSigFlags(NewValue: Integer): Integer;

Parameters

NewValueThe raw flag value to store, for example 1 for SignaturesExist, 2 for AppendOnly or 3 for both; the value is not range-checked

Return values

1The flags were written to the AcroForm dictionary
0No document is loaded or the document has no AcroForm form data

Remarks

Setting bit 2 raises the document's minimum PDF version to 1.5, because AppendOnly is a PDF 1.5 feature and the save-time version gate would otherwise reject the write. GetSigFlags reads the value back and returns 0 when the document has no AcroForm or no /SigFlags entry

See also

GetSigFlags, GetSignatureFieldCount, GetSignatureFieldInfo