THPDFViewerModel Snapshot Methods
Creates page images without constructing a Viewer control and reuses the loaded page render cache
Declarations
function CreatePageSnapshot(PageIndex: Integer; DPI: Integer= 150): TBitmap;
function CreateCurrentPageSnapshot(DPI: Integer= 150): TBitmap;
function CreatePageThumbnail(PageIndex, MaxWidth, MaxHeight: Integer): TBitmap;
function CreateCurrentPageThumbnail(MaxWidth, MaxHeight: Integer): TBitmap;
function PrefetchPageSnapshots(PageIndex, Radius: Integer;
DPI: Integer= 150): Integer;
function PrefetchCurrentPageSnapshots(Radius: Integer= 1;
DPI: Integer= 150): Integer;
function SaveCurrentPageSnapshotToBMP(const FileName: string; DPI: Integer= 150): boolean;
function SaveCurrentPageSnapshotToStream(Stream: TStream;
ImageFormat: THPDFViewerSnapshotFormat; DPI: Integer= 150;
JPEGQuality: Integer= 90): boolean;
function SaveCurrentPageSnapshot(const FileName: string;
ImageFormat: THPDFViewerSnapshotFormat; DPI: Integer= 150;
JPEGQuality: Integer= 90): boolean;
Usage notes
- The caller owns and must free each returned
TBitmap - DPI values are clamped to the supported range from 12 through 2400
- Invalid document or page state returns
nilfrom the creation methods CreatePageThumbnailandCreateCurrentPageThumbnailchoose a render DPI fitted to the requested pixel bounds, preserve the page aspect ratio, apply view rotation, and never return a bitmap wider or taller than the supplied limitsPrefetchPageSnapshotsandPrefetchCurrentPageSnapshotswarm a centered page window asynchronously and cap the scheduled page count atRenderCacheCapacity- The prefetch methods return the number of pages scheduled, use zero-based page indexes, and replace any earlier loaded-page prefetch request
- Snapshot creation preempts active prefetch work before the foreground render, while the document-level prefetch telemetry distinguishes foreground preemption from explicit cancellation
SaveCurrentPageSnapshotToBMPwrites Windows BMP output and returns whether the file was createdTHPDFViewerSnapshotFormatselectsvsfBMP,vsfJPEG, orvsfPNG- Stream output starts at the stream's current position and never takes ownership of the stream
- JPEG quality is clamped from 1 through 100
- File output removes an empty or partially encoded file when saving fails