PDFium Delphi Component Docs

RenderPageThumbnail method

Component: TPdf  ·  Unit: PDFium
Renders any one-based page into a bitmap that fits within the requested thumbnail bounds

Syntax

function RenderPageThumbnail(PageIndex, MaxWidth, MaxHeight: Integer): TBitmap;

function RenderPageThumbnail(PageIndex, MaxWidth, MaxHeight: Integer; Rotation: TRotation; Options: TRenderOptions; Background: TColor; const ColorScheme: TPdfColorScheme): TBitmap;

Parameters

PageIndexInteger - One-based page index to render
MaxWidthInteger - Maximum thumbnail width in pixels
MaxHeightInteger - Maximum thumbnail height in pixels
RotationTRotation - Additional clockwise render rotation
OptionsTRenderOptions - Native PDFium render flags included in the cache key
BackgroundTColor - Bitmap background colour
ColorSchemeTPdfColorScheme - Optional low-vision path and text colour overrides

Return Value

A caller-owned TBitmap, or nil when the document is inactive, the page index is invalid, or the requested size is not positive

Description

The short overload preserves the page aspect ratio and renders on a white background, while the full overload controls rotation, flags, background, and low-vision colours

Both overloads reuse deep internal bitmap copies through the unified thumbnail LRU and return a distinct caller-owned TBitmap on every call

It does not change PageNumber, replace the current loaded page, or fire page-change notifications

Remarks

Example

Bmp := Pdf1.RenderPageThumbnail(3, 180, 240);
try
  if Bmp <> nil then
    Image1.Picture.Assign(Bmp);
finally
  Bmp.Free;
end;

See Also

TPdf.RenderPage, TPdf.Thumbnail, Thumbnail cache, TPdf.PageCount