THotPDF.RenderLoadedPagesParallelOrdered Method
Compiles and renders loaded pages concurrently whilst delivering completed bitmaps in input order through a bounded calling-thread callback
Declaration
function RenderLoadedPagesParallelOrdered(
const PageIndices: array of Integer; DPI, MaxConcurrency,
OutputQueueDepth: Integer; Callback: THPDFParallelRenderPageEvent): Integer; overload;
function RenderLoadedPagesParallelOrdered(
const PageIndices: array of Integer; DPI, MaxConcurrency,
OutputQueueDepth: Integer; Callback: THPDFParallelRenderPageEvent;
out Info: THPDFParallelRenderPipelineInfo): Integer; overload;
Callback and ownership
Callback runs serially on the calling thread with the zero-based input position, requested page index, borrowed bitmap and cancellation flag
The bitmap is valid only for the callback duration and is released immediately after the callback returns, so copy or encode it inside the callback when the result must outlive that invocation
Set Cancel to stop claiming new pages, wake blocked workers, join in-flight work, release unpublished results and return the number of callbacks completed
Callback cancellation also wakes workers waiting for a memory reservation without turning that internal wakeup into an error; an external cancellation token or callback exception still reports failure after cleanup
Backpressure
OutputQueueDepth limits completed bitmaps including the bitmap active in the callback; values below one select the effective worker count and values above the page count are clamped
The scheduler reserves output capacity for the next required input position, so later pages cannot fill the queue and block ordered progress when an earlier page compiles more slowly
With PeakMemorySchedulerEnabled, requested parallelism is reduced from the largest page estimate and currently available global budget and every page reservation remains active from work claim until its borrowed bitmap leaves the callback
Memory reservations are requested in input order before parallel compilation and rendering, so later pages cannot take the budget needed by the next callback
Queued output therefore competes fairly with active compilation and playback for the same process-wide budget whilst cancellation or failure releases unpublished reservations before joining workers
The callback must not mutate or destroy the document whilst workers are active
THPDFParallelRenderPipelineInfo · Display Lists and Print Production