ApplyContentFilterChainExt
Content streams
Description
Runs an ordered instruction-level filter chain over every content layer of one page
Syntax
Delphi
Function ApplyContentFilterChainExt(TargetPage: Integer; Const Filters: TPDFContentFilterChain): Integer;Return values
| 0 | No content layer was written back |
|---|---|
| N | The number of parsed layers accepted by the chain and written back |
Failure behaviour
Returns 0 when no document is selected, TargetPage is outside the 1-based page range, Filters is nil or empty, or all layers are empty, fail to parse or are rejected by a callback. Layers already written remain modified if a later layer is skipped
Remarks
Each non-empty content layer is parsed into a TPDFContentProgram. Callbacks run in registration order and may mutate that program in place. Layer names passed to callbacks are L1, L2 and so on. A callback result of cfrStop stops the remaining callbacks for that layer, prevents that layer from being written and processing then continues with the next layer. The caller retains ownership of Filters
Example
Filters:= PDF.NewContentFilterChain;
try
Filters.Add(FirstFilter, nil);
Filters.Add(SecondFilter, UserData);
ChangedLayers:= PDF.ApplyContentFilterChainExt(1, Filters);
finally
Filters.Free;
end;See also
NewContentFilterChain, ApplyContentFilterChain, SetContentStreamFromString