PDFium Delphi Component Docs

RenderPage method

Component: TPdf  ·  Unit: PDFium
Render contents of a page to a device (screen, bitmap or printer)

Syntax

procedure RenderPage(DeviceContext: HDC; Left, Top, Width, Height: Integer; Rotation: TRotation = ro0; Options: TRenderOptions = []);

DeviceContextHDC. The target Windows device context to render into (screen canvas, printer DC or bitmap DC)
Left, TopInteger. Top-left corner of the destination rectangle within the device context, in device pixels
Width, HeightInteger. Size of the destination rectangle in device pixels. The page is scaled to fill this area
RotationTRotation. Display rotation applied to the page: ro0 (default), ro90, ro180 or ro270
OptionsTRenderOptions. A set of TRenderOption flags controlling rendering quality and behaviour, such as reAnnotations, reLcd, reGrayscale and rePrinting

 

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

Left, TopInteger. Top-left offset within the output bitmap where rendering begins, in pixels
Width, HeightInteger. Size of the destination area in pixels. The page is scaled to fill this area
RotationTRotation. Display rotation applied to the page: ro0 (default), ro90, ro180 or ro270
OptionsTRenderOptions. A set of TRenderOption flags controlling rendering quality and behaviour
ColorTColor. Background fill colour for the bitmap before rendering. Defaults to clWhite

 

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

BitmapTBitmap. An existing TBitmap to render into. The caller is responsible for creating and freeing this bitmap
Left, TopInteger. Top-left offset within the bitmap where rendering begins, in pixels
Width, HeightInteger. Size of the destination area in pixels. The page is scaled to fill this area
RotationTRotation. Display rotation applied to the page: ro0 (default), ro90, ro180 or ro270
OptionsTRenderOptions. A set of TRenderOption flags controlling rendering quality and behaviour
ColorTColor. Background fill colour applied to the bitmap before rendering. Defaults to clWhite

Description

Renders the current page to a device context or bitmap. Three overloads are available: (1) renders directly to an HDC (suitable for printing or on-screen painting); (2) returns a newly created TBitmap that the caller must free; (3) renders into an existing TBitmap passed as parameter

The Left, Top, Width, Height parameters define the output rectangle. Rotation applies a display rotation (use PageRotation to match the stored page rotation) Flags control rendering quality (antialiasing, LCD text, etc.)

Example

var Bmp: TBitmap;
Bmp := Pdf.RenderPage(0, 0, 800, 1000);
try
  Image1.Picture.Assign(Bmp);
finally
  Bmp.Free;
end;

See Also

RenderTile, PageWidth, PageRotation, ReloadPage