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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Printer Command from VFP 1

Status
Not open for further replies.

Cheeqa

Programmer
Apr 24, 2001
1
ID
Hi,

I am using EPSON LX-300 (dot matrix printer) to print out invoice report. Using ??? command to send everything out to the printer. Everything work fine unless the font and font size. I put already commands such as
SET PRINT FONT TO 'Courier', 8
??? CHR(15)
but they does not affect the print result. The font printed on the paper still depend on the printer's control panel (on the top of it's body). Help me...

I have the documentation for my LX-300. It has printers command in it. Like ESC @ to initialize the printer, ESC SI to Select COndensed Mode, ESC a n for NLQ Justification, etc. Can anyone tell me how these all sent from Visual FoxPro?

thank you for your kind
-cheeqa-
 
Using
Code:
SET PRINTER FOR TO [cFontName] [,nSize]
in combination with
Code:
???
is probably useless, as
Code:
??? [data]
will send the data to the printer bypassing the printer driver (and thus the set font).

A possible solution is using a construction like this:
Code:
SET PRINTER FONT 'Courier New', 8 STYLE 'N'
SET CONSOLE OFF
SET PRINTER ON

? "Line in Courier New (normal)"
SET PRINTER FONT 'Courier New', 8 STYLE 'B'
? "Line in Courier New (bold)"

SET PRINTER OFF
SET CONSOLE ON

Sending Esc-codes works like this:
Printer init = ESC @
Code:
cInit = CHR(27) + '@'
??? cInit

However, I'm not sure if ESC-codes will work in combination with printing thru the Windows Printer Driver (unless the spool setting is set to 'raw').

Another way is putting all data and formatting codes into a file, and sent this file to the printer; for example:
Code:
STRTOFILE( CHR(27) + "@Hello world" + CHR(13), "DATA.PRN" )
COPY DATA.PRN TO LPT1.DOS
Diederik Vermeeren
verm1864@exact.nl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top