SetOptionalContentMembership
Content Streams and Optional Content Groups
Description
Atomically replaces the group list, compatibility policy and optional PDF 1.6 visibility expression of a membership dictionary
Syntax
Function TPDFlib.SetOptionalContentMembership(MembershipID: Integer; Const OptionalContentGroupIDs: Array Of Integer; Policy: TPDFlibOCMDPolicy; Const Expression: Array Of TPDFlibOCMDExpressionItem): Integer;Parameters
| MembershipID | A handle returned by NewOptionalContentMembership |
|---|---|
| OptionalContentGroupIDs | A non-empty group array retained as the compatibility fallback |
| Policy | The fallback /P policy |
| Expression | A flat prefix expression, or an empty array to remove /VE |
Return values
| 0 | The membership, groups or expression were invalid and the existing dictionary was not changed |
|---|---|
| 1 | The membership was updated |
Expression format
The first item must be oekAnd, oekOr or oekNot
oekNot requires one operand, while oekAnd and oekOr require one or more operands
Each operator is followed by exactly OperandCount prefix operands; group items use OperandCount = 0
// And(GroupA, Not(GroupB))
Expression[0].Kind := oekAnd;
Expression[0].OperandCount := 2;
Expression[1].Kind := oekGroup;
Expression[1].OptionalContentGroupID := GroupA;
Expression[2].Kind := oekNot;
Expression[2].OperandCount := 1;
Expression[3].Kind := oekGroup;
Expression[3].OptionalContentGroupID := GroupB;Remarks
Validation and expression construction are linear in the number of items and nesting is limited to 64 levels
When /VE is present the output version is at least PDF 1.6, while /OCGs and /P remain available to older readers
See also
TPDFlibOCMDExpressionItem, EnumOptionalContentMembershipExpression