DrawImageAndRelease

Image handling, Page layout, Optimisation

Description

Draws the specified image on the selected page, then releases that image handle from the document image cache after the page resource reference has been registered

Use this helper for generated documents that add many one-use images and do not need to select the same image handle again

Syntax

Delphi

Function TPDFlib.DrawImageAndRelease(ImageID: Integer; Left, Top, Width, Height: Double): Integer;

ActiveX

Function PDFlib::DrawImageAndRelease(ImageID As Long, Left As Double, Top As Double, Width As Double, Height As Double) As Long

DLL

int DLDrawImageAndRelease(int InstanceID, int ImageID, double Left, double Top, double Width, double Height);

Parameters

ImageIDThe image handle returned by an image creation or import function
LeftThe horizontal co-ordinate of the left edge
TopThe vertical co-ordinate of the top edge
WidthThe drawn width
HeightThe drawn height

Return values

0The image handle was invalid, the image could not be drawn, or the handle could not be released
1The image was drawn and the handle was released

Remarks

The saved PDF keeps 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