THotPDF.OpenLoadedPageContentStream

Opens the loaded page /Contents value as one caller-owned read-only logical stream

Delphi declaration

function OpenLoadedPageContentStream(
  PageIndex: Integer;
  out ContentStream: TStream
): boolean;

C++Builder declaration

bool __fastcall OpenLoadedPageContentStream(
  int PageIndex,
  System::Classes::TStream *&ContentStream
);

The result is true when the zero-based loaded page has at least one valid content stream

Behavior

A single content stream and a /Contents array use the same interface, with one line-feed byte inserted between adjacent segments so tokens cannot fuse across a segment boundary

Unfiltered segments remain source-backed and are read without complete materialization, while filtered segments are decoded lazily into one adaptive temporary stream and the previous decoded segment is released when traversal moves elsewhere

Filtered segment lengths are discovered when needed, so reading a known prefix does not decode later segments; requesting Size or seeking from the end resolves every remaining length

The stream supports random reads and seeking but rejects Write and SetSize

Ownership

The caller must free ContentStream, and the owning THotPDF instance plus its loaded document must outlive the returned stream

Use GetLastPageContentSequenceInfo to inspect sequence work and retained-memory telemetry