type TPdfProgressiveDocument = class(TPdf) ... end;
| Method | Description |
|---|---|
Create | Creates the document component and its owned range-request scheduler |
Destroy | Cancels progressive state before releasing inherited document resources |
BeginProgressiveLoad(AStream, AFileSize, AOwnsStream, AInitialAvailableByteCount) | Creates the native availability provider while keeping the logical final size separate from the bytes currently stored |
CheckDocumentAvailability | Returns pdaAvailable, pdaNotAvailable or pdaError and returns merged byte ranges requested by PDFium |
OpenProgressiveDocument | Opens a linearised PDF through FPDFAvail_GetDocument or a fully received non-linearised PDF through FPDF_LoadCustomDocument |
CheckFormAvailability | Gates form-fill initialisation until the native form data is available |
LoadAvailablePage | Gates and loads one one-based page after form availability has reached a terminal state |
CancelProgressiveLoad | Closes the page, form, document, availability handle, callbacks and stream adapter in dependency order |
| Member | Type | Description |
|---|---|---|
ProgressiveLoading | Boolean | True whilst the native availability session is alive |
LogicalFileSize | UInt64 | Final content length supplied by the server or container |
AvailableByteCount | UInt64 | Monotonic length of the contiguous prefix already readable from the stream |
Linearization | TPdfLinearization | Native linearisation verdict once enough header bytes are available |
FirstAvailablePageNumber | Integer | One-based first page after the document handle is open |
OnDataAvailable | TPdfDataAvailableEvent | Overrides the prefix test for sparse or out-of-order range stores |
RangeRequests | TPdfRangeRequestScheduler | Owned scheduler populated from every native document, form and page download hint |
TPdfProgressiveDocument owns the native FPDF_AVAIL handle and the callback records that PDFium may revisit throughout a remote or growing-stream load
Start with the server content length and any initial prefix, call the relevant availability method, dequeue work from RangeRequests, write each response into the backing random-access store, call CompleteRequest and repeat until a terminal availability state is returned
For a contiguous download, advance AvailableByteCount after writing new bytes; for a sparse range cache, assign OnDataAvailable and answer whether each requested offset and size is readable
The scheduler accepts the same native hints returned through the legacy DownloadHints output, removes ranges already known through the prefix or sparse callback, pre-empts overlapping background transfers for page-critical bytes without promoting adjacent tails, and splits transport work at MaxRequestSize
Linearised PDFs can open their document metadata and first page before the entire file arrives; non-linearised PDFs require the complete file and automatically use the normal native custom-stream loader
var
Hints: TPdfDownloadRanges;
Request: TPdfRangeRequest;
State: TPdfDataAvailability;
begin
Progressive.BeginProgressiveLoad(CacheStream, ContentLength,
False, InitialPrefixLength);
repeat
State := Progressive.CheckDocumentAvailability(Hints);
while Progressive.RangeRequests.TryDequeue(Request) do
begin
FetchRangeIntoCache(Request.Offset, Request.Size);
Progressive.RangeRequests.CompleteRequest(Request);
end;
until State <> pdaNotAvailable;
if State = pdaAvailable then
Progressive.OpenProgressiveDocument;
end;
FPDF_FILEACCESS ABI limits the logical file size to 4 GiB and the class raises instead of truncating a larger sizeAvailableByteCount cannot decrease because native parse state assumes downloaded bytes remain availableEnableV8Engine before BeginProgressiveLoad when XFA and V8 support may be requiredCancelProgressiveLoad or destruction finishesCompleteRequest; completion makes the range immediately visible to PDFiumTStream.Position safe; use positioned I/O or an external stream lockRangeRequests.OnCancelRequest to abort active transport operations when the session is cancelled, a higher-priority hint overlaps them, or external sparse coverage makes them redundantTPdfDataAvailability,
TPdfDownloadRange,
TPdfDownloadRanges,
TPdfRangeRequest,
TPdfRangeRequestPriority,
TPdfRangeRequestStatistics,
TPdfRangeRequestScheduler,
TPdfDataAvailableEvent,
TPdfLinearization,
TPdfFormAvailability