#include "l_bitmap.h"
L_LTANN_API L_INT L_AnnPrint(hDC, prcBounds, hObject)
HDC hDC; |
/* handle to the device context (DC) for printing */ |
LPRECT prcBounds; |
/* pointer to the Windows RECT structure for printing */ |
HANNOBJECT hObject; |
/* handle to the annotation object to print */ |
Prints the specified annotation object, fitting it to a bounding rectangle in the specified device context.
Parameter |
Description |
hDC |
Handle to the device context (DC) where the annotation is to print. The mapping mode of the device context must be MM_TEXT. |
prcBounds |
Pointer to the Windows RECT structure that defines the bounding rectangle where this function will fit the annotation for printing. To maintain the aspect ratio, this rectangle should have the same proportions as the annotation object that you are printing. |
hObject |
Handle to the annotation object to print. If you specify a container object, all visible objects in the container will print. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Required DLLs and Libraries
LTANN For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64.
See Also
Functions: |
|
Topics: |
|
|
|
|
|
|
Example
For complete sample code, refer to the ANNOTATE example. This example prints a bitmap and its annotations.
L_INT AnnPrintExample(pBITMAPHANDLE pBitmap, /* Bitmap handle for the image */ HANNOBJECT hContainer) /* Container annotation object */ { L_INT nRet; HDC PrinterDC; L_INT WidthAllowed, HeightAllowed, WidthFactor, HeightFactor; L_INT NewWidth, NewHeight; RECT OutputBounds; /* Get the HDC for the default printer */ PrinterDC = L_PrintBitmap(NULL, NULL, 0, 0, 0, 0, FALSE); /* Initialize variables for fitting the image to the printer */ WidthAllowed = GetDeviceCaps(PrinterDC, HORZRES); HeightAllowed = GetDeviceCaps(PrinterDC, VERTRES); HeightFactor = BITMAPHEIGHT(pBitmap); WidthFactor = BITMAPWIDTH(pBitmap); /* See if using the maximum width will make the image too tall */ if((L_INT)(((L_UINT32)WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed) { /* Use the maximum width, and calculate the height value */ NewWidth = WidthAllowed; NewHeight = (L_INT)(((L_UINT32)NewWidth * HeightFactor) / WidthFactor); } else { /* Use the maximum height, and calculate the width value */ NewHeight = HeightAllowed; NewWidth = (L_INT)(((L_UINT32)NewHeight * WidthFactor) / HeightFactor); } /* Print the bitmap without a page eject */ L_PrintBitmap(PrinterDC, pBitmap, 1, 1, NewWidth, NewHeight, FALSE); /* Specify the bounding rectangle for the annotation output */ OutputBounds.top = 0; OutputBounds.left = 0; OutputBounds.right = NewWidth; OutputBounds.bottom = NewHeight; /* Print the annotations */ nRet = L_AnnPrint(PrinterDC, &OutputBounds, hContainer); if(nRet != SUCCESS) return nRet; /* Send the page eject and end the print job */ L_PrintBitmap(PrinterDC, NULL, 0, 0, 0, 0, TRUE); return SUCCESS; }