THPDFWindowsFormDataSource
HPDFWindowsFormData provides an owned Windows random-access source with a private temporary-file lifetime
THPDFWindowsFormDataSource = class(THPDFRandomAccessSource)
constructor Create;
destructor Destroy; override;
procedure Seal;
function GetSize: Int64; override;
function ReadAt(Offset: Int64; var Buffer; Count: Longint): Longint; override;
property Stream: TFileStream;
end;
Create exclusively reserves a unique temporary file and exposes its writable Stream; write the complete source and call Seal once before supplying it to a loaded document
Seal flushes and closes the writable handle, then reopens the file for read-only access with write sharing denied; it does not take an arbitrary caller path as its backing source
GetSize reports the complete current stream length; ReadAt rejects negative offsets or counts, limits the read to the available bytes, returns zero at or beyond EOF, and restores the stream position on success and failure
A document loaded with OwnSource=False borrows the source; keep it alive until after document destruction; Destroy closes the handle and removes the owned private file
The source has no independent cancellation or byte capacity; the transaction and callback adapters enforce those whilst copying and reading; callers preparing a source directly must apply their own bounds and cancellation policy