THPDFRandomAccessSource Class
Abstract base class that lets THotPDF.LoadFromRandomAccessSource load a PDF from any caller-defined seekable byte store without requiring a TStream implementation
Declaration
THPDFRandomAccessSource = class
public
function GetSize: Int64; virtual; abstract;
function ReadAt(Offset: Int64; var Buffer;
Count: Longint): Longint; virtual; abstract;
end;
Unit
HPDFDoc
Members
| Name | Purpose |
|---|---|
GetSize | Returns the stable byte length of the backing store |
ReadAt | Reads Count bytes starting at Offset into Buffer |
Usage notes
- Derive a subclass and override both abstract methods to adapt HotPDF to HTTP range requests, database BLOBs, compressed archives, encrypted volumes, or any virtual storage that can supply bytes by offset
GetSizemust return a stable, non-negative byte length for the lifetime of the load; HotPDF parses the cross-reference tables and object streams by seeking through this sourceReadAtreturns the number of bytes actually transferred (zero throughCount); the parser treats a short read at the documented end of file as end-of-stream, not as an error- The source must remain valid whilst the loaded document is in use; pass
OwnsSource = Trueto LoadFromRandomAccessSource to have HotPDF free the source automatically