Printing jpg from unmanaged/native code
I have an old unmanaged/native application where I need to print a jpg image of a signature. Is there a way to print the image in native code?
Please have a look at the demo in this KB article, which uses the PC_PRINTER routines (i.e. PC_PRINTER_LOAD_BMP, PC_PRINTER_WRITE_BMP, and PC_PRINTER_FREE_BMP) to print an image file. Although the routines say BMP, it also supports JPG.
The routines PRINTER_LOAD_BMP, PC_PRINTER_WRITE_BMP, and PC_PRINTER_FREE_BMP are working to print my BMP file, however I am having some issues getting the dimensions correct. My image is 441 pixels by 95 pixels and I just want it to print that size. How do I figure out the values for BmpWidth and BmpHeight?
The actual size depends on the font you are using. According to the description of the PC_PRINTER_WRITE_BMP:
|bmp-width||The width of the bitmap in characters. The value you specify is multiplied by the width of the currently selected font to determine the width that is used when printing the bitmap.|
|bmp-height||The height of the bitmap in characters. The value you specify is multiplied by the height of the currently selected font to determine the height that is used when printing the bitmap.|