epson escape printing with usb printer

epson escape printing with usb printer

Postby Richard Chidiak » Mon Dec 11, 2006 8: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby James Bott » Tue Dec 12, 2006 2: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Richard Chidiak » Tue Dec 12, 2006 7: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Antonio Linares » Tue Dec 12, 2006 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Richard Chidiak » Tue Dec 12, 2006 8: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Antonio Linares » Tue Dec 12, 2006 10:39 pm

Richard,

Thanks!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 116 guests