ChrisM2 Valued Contributor.
Valued Contributor.
362 views

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?

0 Likes
7 Replies
Micro Focus Expert
Micro Focus Expert

Re: Printing jpg from unmanaged/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.

–Ғɑɳօ
0 Likes
Highlighted
Jennifer62 Frequent Contributor.
Frequent Contributor.

Re: Printing jpg from unmanaged/native code

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

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Printing jpg from unmanaged/native code

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.
–Ғɑɳօ
0 Likes
ChrisM2 Valued Contributor.
Valued Contributor.

Re: Printing jpg from unmanaged/native code

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!

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Printing jpg from unmanaged/native code

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.

 

–Ғɑɳօ
0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Printing jpg from unmanaged/native code

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

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Printing jpg from unmanaged/native code

For Linux, I would look at the cups api.

https://www.cups.org/
https://www.cups.org/doc/cupspm.html
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.