#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnPrint(hDC, prcBounds, hObject)


handle to the device context (DC) for printing

LPRECT prcBounds;

pointer to the Windows RECT structure for printing


handle to the annotation object to print

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.



The function was successful.

< 1

An error occurred. Refer to Return Codes.

Required DLLs and Libraries


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


L_AnnRealize, L_PrintBitmap


Annotation Functions: Input and Output


Implementing an Automated Annotation Program


Implementing a Non-automated Annotation Program


Automated User Interface for Annotations


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); 
   { /* 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 Version 20.0.2018.7.30
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help