This function retrieves the paper size and specified printing area from the printer device context.

[C++Builder/Visual C++]     BOOL IKGetPaperSize(HDC hDC, LPRECT PrintRect, LPLONG Width, LPLONG Height, BYTE UnitMode);
[Delphi]         function IKGetPaperSize(hDC: HDC; var PrintRect: TRect; var Width, Height: Longint; UnitMode: Byte): LongBool;
[Visual Basic]   Function IKGetPaperSize(ByVal hDC As Long, PrintRect As IKRECT, Width As Long, Height As Long, ByVal UnitMode As Byte) As Long

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 Visual Basic:

   Dim Ret As Long

   Dim Rect1 As IKRECT

   Dim Rect2 As IKRECT

   Dim Width As Long

   Dim Height As Long

   'retrieving the paper size and specified printing area

   Ret = IKGetPaperSize(hDC, Rect1, Width, Height, 1)

   Rect2.Left = 0

   Rect2.Top = 0

   Rect2.Right = Rect1.Right - Rect1.Left

   Rect2.Bottom = Rect1.Bottom - Rect1.Top

   Ret = IKImageOut(hDC, 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

 

The ImageKit10 ActiveX is a product created by Newtone Corporation