Page 1 of 1

SET PRINTER TO OBJECT oPrinter issue

Posted: Wed Jan 06, 2016 4:41 pm
by rdonnay
Is there anyone out there who is using SET PRINTER TO OBJECT oPrinter ?

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

Re: SET PRINTER TO OBJECT oPrinter issue

Posted: Thu Jan 07, 2016 4:29 pm
by bamunz@earthlink.net
I send PCL codes to do whatever I want. (Fonts, shading or whatever).

chr(27)+"(s17v0sb16602T" is arial 7.

Re: SET PRINTER TO OBJECT oPrinter issue

Posted: Thu Jan 07, 2016 4:44 pm
by rdonnay
I tried PCL codes on my own Epson printer.

I'll try again. Thanks.

Re: SET PRINTER TO OBJECT oPrinter issue

Posted: Fri Jan 08, 2016 3:59 am
by c-tec
Hello,
I used it for Matrix printers, actually no more customer use one. With standard ESC sequences it works fine. Laser printers work also, for example chr(27)+"(s3B" for bold on. Here are all codes http://www.pclviewer.com/de/resources/r ... index.html
Speed was no problem for me because the matrix printers are slow.
regards
Rudolf