This function retrieves the paper size and specified printing area from the printer device context.
Parameters
Name | Explanation |
---|---|
hDC | Printer device context |
PrintRect | A structure containing the coordinates specifying the printing area |
Width | Retrieves the width of the paper |
Height | Retrieves the height of the paper |
UnitMode | The units of measure of the retrieved values (0: pixels, 1: 0.1mm) |
Return Value
Returns True (nonzero) if successful. Returns False (0) if unsuccessful.
Explanation
The IKGetPaperSize function retrieves the paper size and specified printing area from the printer device context. When the UnitMode parameter is 0, the PrintRect structure member variables, Width, and Height will be in pixel units. When the the UnitMode parameter is 1, the PrintRect structure member variables, Width, and Heigh will be in 0.1mm units.
Sample Code in Delphi:
Ret: LongBool
Rect1: TRect;
Rect2: TRect;
Width: Longint;
Height: Longint
//retrieving the paper size and specified printing area
Ret := IKGetPaperSize(DC, Rect1, Width, Height, 1);
//use the entire printing area Rect2.Left := 0;
Rect2.Top := 0;
Rect2.Right := Rect1.Right - Rect1.Left;
Rect2.Bottom := Rect1.Bottom - Rect1.Top;
Ret := IKImageOut(DC, ImgHandle, Rect2, False, True, 1);
The differences from the ImageKit5
Function Name | Parameters |
---|---|
IK5GetPaperSize: | hDC, PrintRect, Width, Height |
IKGetPaperSize: | hDC, PrintRect, Width, Height, UnitMode |
If you pass the value used in IK5SetDeviceMode to the UnitMode parameter, then this method will work in the same way as in the ImageKit5