FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour epson escape printing with usb printer
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
epson escape printing with usb printer
Posted: Mon Dec 11, 2006 08:21 PM

Good evening

I am trying since quite a while to print escape codes on a usb printer without success.

The following code will open a cash tray when the printer is connected to a "dos type" parallel port (lpt1, lpt2 or lpt3)

  CPORT   := OPRN:GETPORT()
  CDOSPRT := TDOSPRN():NEW(CPORT)
  Ntext   := SPACE(45)
  Ntext   := "CHR(27) +'p'+ CHR(0)+CHR(100)+CHR(100)"
  CDOSPRT:Say(0,00,&(Ntext),.F.)    // open Cash
  CDOSPRT:END()

the code will not work anymore if the printer is "virtual epson lpt" or worst if it is usb.

I am trying to find a replacement as tdosprn can not be used anymore in my case and in today's printers.

I have tried the following without succcess

define PASSTHROUGH 19

ESCAPE( oprn:hdc, PASSTHROUGH, nText) // ntext is the same as above

I have also tried xharbour functions without success

printsend(CHR(27) +'p'+ CHR(0)+CHR(100)+CHR(100),ICAISSE) // icaisse is the correct name of the printer

And also
CFILE := "c:\test.TXT"
nHandle := fCreate( cFile )
FWRITE( nHandle, NTEXT)
fClose( nHandle )
PrintFileRaw(ICAISSE,CFILE)

Again no success.

I really do not know where to go from here....

Has anyone succeeded sending escape codes to "USB" printer or Epson virtual printer (windows driver) ?

If yes, could you share a sample ?

Thanks in advance for your time,

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
epson escape printing with usb printer
Posted: Tue Dec 12, 2006 02:22 AM

Richard,

There might be some clues here:

How To Use PASSTHROUGH Escape to Send Data Directly to Printer

http://support.microsoft.com/kb/q96795/

And from that page you can go here:
HOWTO: Send Raw Data to a Printer by Using the Win32 API

http://support.microsoft.com/kb/138594/EN-US/

On both pages I see that they tell the spooler that the print job is done right after the data is sent. Are you doing that?

On the second reference above there is a C program. Perhaps one of the C programmers here could translate that to FWH for you.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
epson escape printing with usb printer
Posted: Tue Dec 12, 2006 07:25 PM
James Bott wrote:Richard,

There might be some clues here:

How To Use PASSTHROUGH Escape to Send Data Directly to Printer
http://support.microsoft.com/kb/q96795/

And from that page you can go here:
HOWTO: Send Raw Data to a Printer by Using the Win32 API
http://support.microsoft.com/kb/138594/EN-US/

On both pages I see that they tell the spooler that the print job is done right after the data is sent. Are you doing that?

On the second reference above there is a C program. Perhaps one of the C programmers here could translate that to FWH for you.

James


Thank you James,

Printfileraw from xharbour was the solution i adapted and it is working in all cases. Now i can send all my "Escape" codes to any printer.

Thanks for the reply

Best regards

Richard

PS : If anyone needs help on this matter (sending esc codes to any printer), feel free to ask.
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
epson escape printing with usb printer
Posted: Tue Dec 12, 2006 07:33 PM

Richard,

> Printfileraw from xharbour was the solution i adapted and it is working in all cases.

Would you please post a small sample of its use ? many thanks!

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
epson escape printing with usb printer
Posted: Tue Dec 12, 2006 08:05 PM
Antonio Linares wrote:Richard,

> Printfileraw from xharbour was the solution i adapted and it is working in all cases.

Would you please post a small sample of its use ? many thanks!


Antonio
Sure no problem

this is a snapshot

CFILE := "PRN.TXT"
nHandle := fCreate( cFile )
Ntext := SPACE(45)
Ntext := CHR(27) +'p'+ CHR(0)+CHR(100)+CHR(100) // this will open a cash tray
FWRITE( nHandle, Ntext)
fClose( nHandle )
PrintFileRaw(myprintername,CFILE) //myprintername is a valid printer name
FERASE(CFILE)

you can add as many lines as you wish in the text file (process several esc commands)

Regards

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
epson escape printing with usb printer
Posted: Tue Dec 12, 2006 10:39 PM

Richard,

Thanks!

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
epson escape printing with usb printer
Posted: Tue Dec 12, 2006 10:42 PM

Richard,

Glad you got that working; I know it has been a problem for you for some time. Thanks for sharing the solution.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion