TPDFInlineBoundaryEvent

Data types, content stream editing

Description

TPDFInlineBoundaryEvent is the handler type of OnInlineImageBoundary. Parse calls it for every BI keyword it meets, before any instruction is produced for that image, and uses the returned position to capture the entire BI..EI slice as one coBeginImage instruction.

When no handler is assigned, the parser proves the boundary itself from the image dictionary's declared width, height, bits per component, colour space and filter, and only scans for an EI token when that proof is inconclusive. Assigning a handler makes the boundary the application's responsibility.

Syntax

Delphi

TPDFInlineBoundaryEvent = Function(Const Source: AnsiString;
  BIStart: Integer; Out AfterEI: Integer): Boolean Of Object;

Parameters

SourceThe complete content stream being parsed; all positions index it one-based
BIStartOne-based position of the BI keyword
AfterEIOut parameter: one-based position just past the terminating EI token

Return values

TrueThe boundary is proven and AfterEI is used, provided it passes the parser's validation
FalseThe boundary could not be proven; parsing stops and returns False without falling back to a guessed delimiter

Remarks

The returned position is validated: it must lie more than four bytes past BIStart, at most one byte past the stream, and the two bytes before it must read EI. A value that fails any of these checks also fails the parse.

The handler type is method-based (Of Object), so it can be a method of any object; assign it before calling Parse, because the property is only consulted while parsing.

See also

OnInlineImageBoundary, Parse, TPDFContentProgram, TPDFContentInstruction, ReplaceInlineImage