PDFium Delphi Component Docs

RenderTile method

Component: TPdf  ·  Unit: PDFium
Render rectangular area of a page to a new bitmap. Returned bitmap has to be manually released

Syntax

function RenderTile(Left, Top, Width, Height, PageWidth, PageHeight: Integer; Rotation: TRotation = ro0; Options: TRenderOptions = []; Color: TColor = clWhite): TBitmap;

Left, TopInteger. Top-left corner of the tile region to render, in pixels, relative to the full page at the given zoom level
Width, HeightInteger. Size of the tile in pixels. The returned bitmap will have these dimensions
PageWidth, PageHeightInteger. The full page dimensions in pixels at the desired zoom level. These determine the scale at which the page is rendered
RotationTRotation. Display rotation applied to the page: ro0 (default), ro90, ro180, or ro270
OptionsTRenderOptions. A set of TRenderOption flags controlling rendering quality and behavior
ColorTColor. Background fill color for the bitmap before rendering. Defaults to clWhite

 

procedure RenderTile(Bitmap: TBitmap; Left, Top, Width, Height, PageWidth, PageHeight: Integer; Rotation: TRotation = ro0; Options: TRenderOptions = []; Color: TColor = clWhite);

BitmapTBitmap. An existing TBitmap to render the tile into. The caller is responsible for creating and freeing this bitmap
Left, TopInteger. Top-left corner of the tile region to render, in pixels, relative to the full page at the given zoom level
Width, HeightInteger. Size of the tile in pixels
PageWidth, PageHeightInteger. The full page dimensions in pixels at the desired zoom level
RotationTRotation. Display rotation applied to the page: ro0 (default), ro90, ro180, or ro270
OptionsTRenderOptions. A set of TRenderOption flags controlling rendering quality and behavior
ColorTColor. Background fill color applied to the bitmap before rendering. Defaults to clWhite

Description

Color = clNone or Color = clDefault selects a transparent background and an alpha-capable PDFium bitmap. Uncovered tile pixels retain zero alpha independently of the native page background-transparency query; the default clWhite background is opaque

Renders a rectangular tile of the current page. Unlike RenderPage, which renders the full page at a given size, RenderTile renders only a cropped region. This is ideal for high-resolution display of large pages where rendering the full page at once would consume too much memory

PageWidth / PageHeight define the total rendered size of the page (the "zoom level"), and Left / Top / Width / Height define the output window within that total size

Example

// Render top-left 800x600 tile of a page scaled to 2000x2828
var Bmp: TBitmap;
Bmp := Pdf.RenderTile(0, 0, 800, 600, 2000, 2828);
try
  Image1.Picture.Assign(Bmp);
finally
  Bmp.Free;
end;

See Also

RenderPage, PageWidth