#include "l_bitmap.h"
L_LTANN_API L_INT L_AnnPrint(hDC, prcBounds, hObject)
Prints the specified annotation object, fitting it to a bounding rectangle in the specified device context.
Handle to the device context (DC) where the annotation is to print. The mapping mode of the device context must be MM_TEXT.
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.
Handle to the annotation object to print. If you specify a container object, all visible objects in the container will print.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Required DLLs and Libraries
Win32, x64.
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;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document