PDFium Delphi Component Docs

ClearThumbnailCache method

Component: TPdf  ·  Unit: PDFium
Releases every preview currently retained by the revision-aware TPdf thumbnail cache

Syntax

procedure ClearThumbnailCache;

Description

The call drops all retained bitmap entries and all cached negative entries, the remembered absence of an optional embedded page /Thumb, so the memory used by stored bitmaps is returned immediately

Limits, cumulative hit, miss, and eviction counters, the active page, and the document content revision stay unchanged. The next ExtractThumbnail or RenderPageThumbnail lookup re-extracts or re-renders the preview and counts as a miss

Extraction and rendering remain fully available after the call, so the method is safe to invoke before memory-critical operations such as large banded exports or parallel renders, or after external changes to the underlying document that bypass TPdf

Remarks

The procedure takes the same render lock used by native PDFium page access, so it waits briefly for in-flight rendering to finish and can be called while TPdfThumbnailView instances are attached

Calling it does not advance ThumbnailRevision, because the document content itself did not change; page edits and document replacement advance the revision through their own invalidation paths

Example

Pdf.ClearThumbnailCache;
Stats := Pdf.ThumbnailCacheStatistics;
LogThumbnailState(Stats.EntryCount, Stats.StoredBytes);

See Also

Thumbnail cache, ThumbnailCacheStatistics, ThumbnailCacheMaxEntries, RenderPageThumbnail, ExtractThumbnail