StartRangeSourcePrefetch
Document management, Progressive loading, Performance
Description
Queues a background job that repeatedly discovers and fetches the missing byte ranges required by a page, form or indirect-object dependency graph
Syntax
Delphi
Function TPDFlib.StartRangeSourcePrefetch(DataKind, Index, Priority: Integer;
MaxBytes: Int64= 0; ReadAheadBytes: LongInt= 0;
MaxPasses: Integer= 0): Integer;Parameters
| DataKind | PDF_RANGE_DATA_PAGE, PDF_RANGE_DATA_FORM or PDF_RANGE_DATA_OBJECT |
|---|---|
| Index | A one-based page number, zero for the form query, or an indirect object number |
| Priority | PDF_RANGE_PREFETCH_PRIORITY_LOW, PDF_RANGE_PREFETCH_PRIORITY_NORMAL, PDF_RANGE_PREFETCH_PRIORITY_HIGH or PDF_RANGE_PREFETCH_PRIORITY_CRITICAL |
| MaxBytes | The job read budget; zero selects 64 MiB and an explicit value must hold at least one source chunk |
| ReadAheadBytes | Extra bytes scheduled after each discovered dependency range before chunk alignment |
| MaxPasses | The maximum dependency-discovery rounds; zero selects 128 |
Return value
A positive stream-local job handle on success, or zero with LastErrorCode set to 401 when the selected document is not range-backed or the arguments are invalid
Remarks
One worker services each range stream and selects the highest queued priority, preserving FIFO order within equal priorities
The worker uses an isolated parser over the shared byte-range cache, so dependency discovery does not share mutable reader state with foreground document operations
The byte budget includes uncached reads performed while initializing and advancing the isolated dependency parser
Prefetched bytes remain subject to the stream cache budget and least-recently-used eviction policy