I have used this in the past when helping some Clipper developers convert their old reports to use the Windows printer driver system. The biggest caveat to this is the slowness of the printer. Xbase++ appears to be running some kind of emulation to make this work. Unfortunately, there seems to be no way to control the font when printing this way. I tried to do it as shown below but it doesn't work. Any ideas? The customer doesn't want to convert his reports using DCPRINT because there are too many of them.
Code: Select all
#INCLUDE "dcdialog.CH"
#INCLUDE "gra.CH"
#Pragma Library("xppui2.lib")
FUNCTION Main()
LOCAL oPrinter, oDlg, i, aPaperSize, aDCSize, oPS, oFont
oDlg := XbpPrintDialog():new()
oDlg:create()
oPrinter := oDlg:display()
IF oPrinter == NIL
QUIT
ENDIF
SET PRINTER TO OBJECT oPrinter
SET DEVICE TO PRINT
SET PRINT ON
aPaperSize := oPrinter:paperSize()
aDCSize := {aPaperSize[5] - aPaperSize[3], ;
aPaperSize[6] - aPaperSize[4]}
oPS := XbpPresSpace():New()
oPS:Create( oPrinter, aDCSize, GRA_PU_LOMETRIC, GRA_PU_PIXEL )
oFont := XbpFont():new(oPS)
oFont:compoundName := '7.Arial'
oFont:create()
// ?? Chr(27)+'M'
FOR i := 1 TO 5
@ i,10 SAY 'This is line ' + Alltrim(Str(i))
NEXT
EJECT
SET DEVICE TO SCREEN
SET PRINT OFF
RETURN nil