FitImageAndRelease

Image handling, Page layout, Optimisation

Description

Fits the specified image inside a target rectangle, preserves the image aspect ratio, applies the requested alignment and rotation, then releases its image handle from the document image cache

Reference page for FitImageAndRelease. The function belongs to Image handling, Page layout, Optimisation and keeps all identifiers exactly as shown

Syntax

Delphi

Function TPDFlib.FitImageAndRelease(ImageID: Integer; Left, Top, Width, Height: Double; HAlign, VAlign, Rotate: Integer): Integer;

ActiveX

Function PDFlib::FitImageAndRelease(ImageID As Long, Left As Double, Top As Double, Width As Double, Height As Double, HAlign As Long, VAlign As Long, Rotate As Long) As Long

DLL

int DLFitImageAndRelease(int InstanceID, int ImageID, double Left, double Top, double Width, double Height, int HAlign, int VAlign, int Rotate);

Return values

ImageIDThe image handle returned by an image creation or import function
LeftThe horizontal co-ordinate of the target rectangle
TopThe vertical co-ordinate of the target rectangle
WidthThe target rectangle width
HeightThe target rectangle height
HAlignHorizontal alignment inside the rectangle, where 0 is left, 1 is centre, and 2 is right
VAlignVertical alignment inside the rectangle, where 0 is top, 1 is centre, and 2 is bottom
RotateRotation mode, where 0 is normal, 1 is 90 degrees anti-clockwise, 2 is 90 degrees clockwise, and 3 is 180 degrees

Return values

0The image handle was invalid, a placement option was out of range, the image could not be drawn, or the handle could not be released
1The image was fitted and the handle was released

See also

The saved PDF retains the image object because the page resource dictionary already references it before the cache handle is released

After this function succeeds, SelectImage(ImageID) returns 0 for that released handle