Skip to main content

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?

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.


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.

We are actually looking for the same thing using native code on Linux.  Any examples for that?


We are actually looking for the same thing using native code on Linux.  Any examples for that?

Unfortunately, there is no call-by-name routine to print an image. If you however know how to do this from the command line, then you may have your Cobol program to call system to execute the same command line.

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?

 

Thanks again!


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?

 

Thanks again!

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.

 


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.

 

Have a look at the options parameter, this may be of use to you.


We are actually looking for the same thing using native code on Linux.  Any examples for that?

For Linux, I would look at the cups api.

https://www.cups.org/
https://www.cups.org/doc/cupspm.html