L_AnnPrint

Summary

Prints the specified annotation object, fitting it to a bounding rectangle in the specified device context.

Syntax

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnPrint(hDC, prcBounds, hObject)

Parameters

HDC hDC

Handle to the device context (DC) where the annotation is to print. The mapping mode of the device context must be MM_TEXT.

LPRECT 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.

HANNOBJECT hObject

Handle to the annotation object to print. If you specify a container object, all visible objects in the container will print.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

For a complete sample code, refer to the \Examples\Annotation\C\Annotate demo.
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; 
   L_HDC    PrinterDC; 
   L_INT    WidthAllowed, HeightAllowed, WidthFactor, HeightFactor; 
   L_INT    NewWidth, NewHeight; 
   L_RECT   OutputBounds; 
 
   /* Get the HDC for the default printer */ 
   PrinterDC = L_PrintBitmap(NULL, NULL, 0, 0, 0, 0, L_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, L_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 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.