SET PRINTER TO OBJECT oPrinter issue

This forum is for general support of Xbase++
Post Reply
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

SET PRINTER TO OBJECT oPrinter issue

#1 Post 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
The eXpress train is coming - and it has more cars.

bamunz@earthlink.net
Posts: 23
Joined: Fri Apr 17, 2015 11:09 am

Re: SET PRINTER TO OBJECT oPrinter issue

#2 Post by bamunz@earthlink.net »

I send PCL codes to do whatever I want. (Fonts, shading or whatever).

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

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: SET PRINTER TO OBJECT oPrinter issue

#3 Post by rdonnay »

I tried PCL codes on my own Epson printer.

I'll try again. Thanks.
The eXpress train is coming - and it has more cars.

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: SET PRINTER TO OBJECT oPrinter issue

#4 Post 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
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

Post Reply