L_AnnPrint
#include "l_bitmap.h"
L_INT EXT_FUNCTION 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. This function is available in the Document/Medical Toolkits.
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. |
Platforms
Windows 95 / 98 / Me, Windows 2000 / XP.
See Also
Functions: |
|
Topics: |
|
|
|
|
|
|
Example
For complete sample code, refer to the ANNOTATE example.
/* This example prints a bitmap and its annotations. */
BITMAPHANDLE LeadBitmap; /* Bitmap handle for the image */
HANNOBJECT hContainer; /* Container annotation object */
void TestAnnPrint(HWND hWnd)
{
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, &LeadBitmap, 0, 0, 0, 0, FALSE);
/* Initialize variables for fitting the image to the printer */
WidthAllowed = GetDeviceCaps(PrinterDC, HORZRES);
HeightAllowed = GetDeviceCaps(PrinterDC, VERTRES);
HeightFactor = BITMAPHEIGHT(&LeadBitmap);
WidthFactor = BITMAPWIDTH(&LeadBitmap);
/* 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, &LeadBitmap, 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 */
L_AnnPrint(PrinterDC, &OutputBounds, hContainer);
/* Send the page eject and end the print job */
L_PrintBitmap(NULL, &LeadBitmap, 0, 0, 0, 0, TRUE);
return;
}