PDFium Component Docs

TPdfStreamAdapter class

Unit: PDFium
Bridge from a seekable Pascal TStream to PDFium's FPDF_FILEACCESS callback structure

Syntax

konstruktor Create(AStream: TStream; AOwnsStream: Boolean = False);
property Stream: TStream read FStream;
svojstvo OwnsStream: Boolean read FOwnsStream;
svojstvo FileAccess: FPDF_FILEACCESS read FFileAccess;

Members

MemberDescription
CreateWrap a seekable TStream i opcionalno prenijeti tok ownership to the adapter
DestroyReleases adapter state and frees Stream when OwnsStream is True
StreamUnderlying stream passed to the constructor
OwnsStreamTrue when the adapter should free the stream in Destroy
FileAccessPDFium callback record suitable for FPDF_LoadCustomDocument

Description

TPdfStreamAdapter lets PDFium request byte ranges from a stream on demand instead of copying the whole PDF into memory before loading

The stream must support seeking and must remain alive for as long as the loaded FPDF_DOCUMENT can read from the adapter

TPdf.LoadCustomDocument uses the same adapter path for the high-level component API

Example

Adapter := TPdfStreamAdapter.Create(FileStream, True);
Document := FPDF_LoadCustomDocument(@Adapter.FileAccess, nil);

See Also

TPdf.LoadCustomDocument