THPDFLoadedPageRenderSession Class
Retains page render state and a live partial bitmap so a loaded page can be rendered over multiple bounded calls
Declaration
THPDFLoadedPageRenderSession = class(TObject)
public
constructor Create(AOwner: THotPDF; PageIndex, DPI: Integer;
CancellationToken: THPDFCancellationToken);
constructor CreateRegion(AOwner: THotPDF; PageIndex: Integer;
RegionLeft, RegionBottom, RegionRight, RegionTop: Single;
DPI: Integer; CancellationToken: THPDFCancellationToken);
function ContinueRender(MaxMilliseconds: Cardinal = 0;
MaxObjects: Integer = 0): THPDFProgressiveRenderStatus;
function TakeBitmap: TBitmap;
function GetFallbackDiagnostics: THPDFRenderFallbackDiagnostics;
property Bitmap: TBitmap read GetBitmap;
property ObjectsProcessed: Integer read GetObjectsProcessed;
property TotalObjects: Integer read GetTotalObjects;
property ProgressiveJPEGScansDecoded: Integer
read GetProgressiveJPEGScansDecoded;
property ProgressiveJPEGImagesDecoded: Integer
read GetProgressiveJPEGImagesDecoded;
property Status: THPDFProgressiveRenderStatus read GetStatus;
property IsRegionRender: Boolean read FIsRegionRender;
property RegionLeft: Single read FRegionLeft;
property RegionBottom: Single read FRegionBottom;
property RegionRight: Single read FRegionRight;
property RegionTop: Single read FRegionTop;
property RegionVisiblePaintObjects: Integer
read GetRegionVisiblePaintObjects;
property RegionCulledPaintObjects: Integer
read GetRegionCulledPaintObjects;
property FallbackDroppedCount: Integer read GetFallbackDroppedCount;
property OnProgress: THPDFProgressiveRenderProgressEvent
read FOnProgress write SetOnProgress;
property OnProgressiveJPEGScan: THPDFProgressiveJPEGScanEvent
read FOnProgressiveJPEGScan write SetOnProgressiveJPEGScan;
end;
Unit
HPDFDoc
Status values
prsReadymeans the page is initialized and no content operator has runprsPausedmeans a budget ended before all operators completedprsCompletedmeans the complete page bitmap is availableprsCancelledmeans the callback or token stopped the session at an operator boundary
Usage notes
- Sessions are normally created by the
THotPDF.BeginLoadedPageProgressiveRenderandBeginLoadedPageProgressiveRegionRenderfactory methods, which callCreateor theCreateRegionregion constructor on the caller's behalf - Either budget can be zero for unlimited work, while both zero values run to a terminal state in one call
Bitmapremains owned by the session and is intended for read-only preview accessTakeBitmapis valid only in a terminal state and transfers ownership to the callerProgressiveJPEGScansDecodedandProgressiveJPEGImagesDecodedcount successful incremental image work, whileOnProgressiveJPEGScancan cancel after a visible scanIsRegionRenderidentifies ROI sessions; the region properties retain the requested user-space bounds and the visible and culled counters describe display-list paint selectionFallbackDroppedCountcounts render fallback diagnostics dropped after the retained limit, whileGetFallbackDiagnosticsreturns the retained THPDFRenderFallbackDiagnostic records describing why individual objects fell back from the native renderer- Each diagnostic carries a THPDFRenderFallbackKind value, the operator and object names when known, and the reason text
- The loaded
THotPDFinstance and cancellation token must remain alive until the session is freed