Table of Contents

ITMSFNCCustomPDFGraphicsLib.DrawImageFromFile Method

Draws an image loaded from a file at the specified point and returns its drawn bounds.

API unit family: TMSFNCPDFGraphicsLib Declaring type: ITMSFNCCustomPDFGraphicsLib

Overloads

Overload 1

Draws an image loaded from a file at the specified point and returns its drawn bounds.

function DrawImageFromFile(AFileName: String; Point: TPointF; ImageType: TTMSFNCPDFGraphicsLibImageType = itOriginal; Quality: Single = 1.0): TRectF; overload;

Parameters

Name Description
AFileName Path of the image file to draw.
Point Top-left position of the image in PDF coordinate units.
ImageType Controls whether the image is rendered at original size or fitted.
Quality JPEG compression quality from 0.0 (lowest) to 1.0 (highest).

Returns

Rectangle occupied by the drawn image in PDF coordinate units.

Overload 2

Draws an image from a file over a background color at the specified point.

function DrawImageFromFile(AFileName: String; ABackgroundColor: TTMSFNCGraphicsColor; Point: TPointF; ImageType: TTMSFNCPDFGraphicsLibImageType = itOriginal; Quality: Single = 1.0): TRectF; overload;

Parameters

Name Description
AFileName Path of the image file to draw.
ABackgroundColor Color painted behind transparent pixels.
Point Top-left position of the image in PDF coordinate units.
ImageType Controls whether the image is rendered at original size or fitted.
Quality JPEG compression quality from 0.0 (lowest) to 1.0 (highest).

Returns

Rectangle occupied by the drawn image in PDF coordinate units.

Overload 3

Draws an image from a file scaled to fill the specified rectangle.

function DrawImageFromFile(AFileName: String; Rect: TRectF; Stretch: Boolean = True; AspectRatio: Boolean = True; ImageType: TTMSFNCPDFGraphicsLibImageType = itOriginal; Quality: Single = 1.0; Center: Boolean = True): TRectF; overload;

Parameters

Name Description
AFileName Path of the image file to draw.
Rect Target rectangle in PDF coordinate units.
Stretch When True, scales the image to fill the rectangle.
AspectRatio When True, preserves the image aspect ratio while stretching.
ImageType Controls the image rendering mode.
Quality JPEG compression quality from 0.0 to 1.0.
Center When True, centers the image within the rectangle.

Returns

Rectangle occupied by the drawn image in PDF coordinate units.

Overload 4

Draws an image from a file over a background color and scaled to fill the specified rectangle.

function DrawImageFromFile(AFileName: String; ABackgroundColor: TTMSFNCGraphicsColor; Rect: TRectF; Stretch: Boolean = True; AspectRatio: Boolean = True; ImageType: TTMSFNCPDFGraphicsLibImageType = itOriginal; Quality: Single = 1.0; Center: Boolean = True): TRectF; overload;

Parameters

Name Description
AFileName Path of the image file to draw.
ABackgroundColor Color painted behind transparent pixels.
Rect Target rectangle in PDF coordinate units.
Stretch When True, scales the image to fill the rectangle.
AspectRatio When True, preserves the image aspect ratio while stretching.
ImageType Controls the image rendering mode.
Quality JPEG compression quality from 0.0 to 1.0.
Center When True, centers the image within the rectangle.

Returns

Rectangle occupied by the drawn image in PDF coordinate units.