1. |
Define the following global variables: |
LBitmapBase BitmapBase; // bitmap
L_FLOAT fRealWidth; // Image's real width in inches
L_FLOAT fRealHeight; // Image's real height in inches
L_FLOAT fPrnDPIX; // Number of pixels per logical inch along the screen width
L_FLOAT fPrnDPIY; // Number of pixels per logical inch along the screen height
2. |
Load the image in a LEAD bitmap: |
BitmapBase.Load(TEXT("C:\\IMAGE1.CMP"), 0, ORDER_BGR, NULL, NULL);
3. |
Calculate the real width and height of the bitmap in inches: |
fRealWidth = (L_FLOAT)BitmapBase.GetWidth() / (L_FLOAT)BitmapBase.GetXResolution();
fRealHeight = (L_FLOAT)BitmapBase.GetHeight() / (L_FLOAT)BitmapBase.GetYResolution();
4. |
Get the printer's device context: |
HDC hdcPrinter = NULL; // Printer device context
LPrint LeadPrint(&BitmapBase); // LEAD Print
hdcPrinter = LeadPrint.GetPrinterDC();
5. |
Get the width and height DPI: |
fPrnDPIX = (L_FLOAT)GetDeviceCaps(hdcPrinter, LOGPIXELSX);
fPrnDPIY = (L_FLOAT)GetDeviceCaps(hdcPrinter, LOGPIXELSY);
6. |
Now you are ready to print the image with real size in inches: |
if(LeadPrint.IsValid() && hdcPrinter)
LeadPrint.Print(hdcPrinter, 1, 1, (L_INT)(fRealWidth * fPrnDPIX), (L_INT)(fRealHeight * fPrnDPIX));
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET