Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print BMP/JPG directly to printer (without using Report Writer) 1

Status
Not open for further replies.

eys

Programmer
Mar 5, 2001
28
MX
Hello,

I need to print graphic coupons in a ticket of a POS system that we make. The page lenght is variable because it depends of the lines of the ticket.

I have'it wokring with text lines with diferent fonts, BUT, I need to print JPG's files (small ones) to a receipt printer, but if I use reporte writer, the page ejects at the size defined by windows.

Is there a Class to do this? or an API call? I found that I can open an paint object and the click to print the image, and Works! but in the real world, the process have to be an automatic print of tickets.

Please help.

Jose Carlos
 
If you are able to use @...SAY, you could do it that way:
Code:
SET CONSOLE OFF
SET PRINTER ON PROMPT
SET DEVICE TO PRINTER

@ 1,1 say 'Test'
@ 2,1 say "mylogo.jpg" bitmap 
@ 3,1 say "Done"

SET DEVICE TO SCREEN
SET PRINTER OFF
SET PRINTER TO
SET CONSOLE ON

Of ccourse, depending on where it is located and the actual size, you may have to make allowances.

-Dave Summers-
[cheers]
Even more Fox stuff at:
 
eys

If you use ShellExecute() to print your image files it's important to associate the Windows file type with an image editor that will not stop and request user input or confirmation and does print the image correctly from a size point of view.

In the same way if you use the 'open' option with ShellExecute(), it's always the Windows associated editor that opens the file or in this instance actually performs the printing task - some are better behaved than others!

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.com
PDFcommandertm.co.uk


 
Dave :

You're rigth, I miss the simplest solution, and it works! BUT (always there's a but) It prints a delimited portion of the BMP/JPG.

Is there a way to control this? or Its a standard size?

Where can I found more documentation about @ say old command, because FoxHelp just say its older and thats it.

Gracias.

Jose Carlos

 
It prints a delimited portion of the BMP/JPG.
I guess I don't understand what you mean.

Anyway, you can resize the image using the SIZE clause, and throw in a STRETCH or ISOMETRIC clause to make it conform to the size you specify:
Code:
@ 2,1 SAY "mylogo.jpg" BITMAP SIZE 20, 20 ISOMETRIC
-or-
@ 2,1 SAY "mylogo.jpg" BITMAP SIZE 20, 20 STRETCH
Whichever suits your fancy.


Here's a snippet from the 'old' help:
Code:
@ <row, column>
SAY <file> BITMAP | <general field>
   [STYLE <expC1>]
   [CENTER]
   [ISOMETRIC | STRETCH]
   [SIZE <expN1>, <expN2>]
STYLE = either "Q" or "T" for Opaque or Transparent.
If ISOMETRIC is included, the picture or object is scaled so that its proportions are maintained. The picture is shrunk or expanded to fit within the specified area and isn't distorted.

If STRETCH is included, the picture or object is scaled horizontally, vertically or in both directions to fit the picture or object within the area specified by the SIZE clause. The picture or object's proportions are not maintained.

-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top