Thread: FoxPro Some General Questions/Print on a deafault printer

Print on a deafault printer
Add a Printer in the Printers Control Panel, then use ??? to output lines to that printer.

#DEFINE VFP_CRLF CHR(13) + CHR(10)
set printer to name (lcPrinter) && receipt printer name in Control panel
??? 'output line here' + VFP_CRLF
...
??? 'last output line' + VFP_CRLF
set printer to default



@ pnRow,1 say lcMerchantInfo font "20 cpi"
@ pnRow,1 say lcCompany font "15 cpi"
@ pnRow,1 say lcMerchantInfo font "20 cpi"
@ pnRow,1 say lcCompany font "10 cpi", 13.5 style "B"


TMT88II should have come with the fonts you can use w/o OPOS.



SET DEVICE TO PRINT
SET PRINTER TO NAME (GETPRINTER())
@ 1,1 SAY "Something " FONT "Verdana", 26 style "B"
@ 20,20 SAY "Something " FONT "Comic Sans MS", 36 style "N"
SET DEVICE TO screen
SET PRINTER to



You should be able to do see an appropriate list at least in Visual FoxPro 9 without changing the Windows default printer. If I remember correctly setting your Visual FoxPro default printer or, if saving printer environment, the printer for a particular report should do it.

Part of what I may not remember correctly at this very moment involves whether the Builder dialogs will do it differently than the Product dialogs on this score.

In Word, same thing, I'm pretty sure. Try the following:

1. Open a Word document

2. Go to the Print dialog, choose Generic Text printer.

3. Hit "Close" in the dialog instead of "OK", to associate a different printer with your current Word environment.

4. Now try to change a font in your Word document. What do you see in the font list?

To see the appropriate behavior in Visual FoxPro outside of a report, very similar to Word's actually, you can SET PRINTER TO NAME and then use GETFONT() with the "P" argument (this is only in Visual FoxPro 9 also).

So, In other words, if you do this, and set Generic Text as your printer:

SET PRINTER TO NAME (GETPRINTER())
? GETFONT("Courier",12,"P") && any font name

... you see only printer-appropriate fonts.



SET PRINTER TO NAME ALLTRIM(m.LS_CHKPRN)
SET PRINTER ON
SET CONSOLE OFF

? '12345678901234567890123456789012345678901234567890' FONT 'Arial'  ,7 STYLE 'N'
? '1234567890123456789012345678901234567890' FONT 'Arial'  ,8 STYLE 'N'

? '12345678901234567890123456789012345678901234567890' FONT 'Courier'  ,7 STYLE 'N'

? '1234567890123456789012345678901234567890' FONT 'Courier'  ,8 STYLE 'N'


SET CONSOLE ON
SET PRINTER OFF
SET PRINTER TO DEFAULT