Page 1 of 1

USB Printing with OPOS Drivers

Posted: Tue May 02, 2017 2:09 am
by ampandya
Hi,
Has anyone used OPOS driver for the POS USB thermal printer?

At the moment i can use this printer with the USB windows drivers and it works but when i want to print the Receipt on the printer it creates new job for each line,
and that cause the printer to print every single line and feed. . . . . .

resulting very slow printing.


Thank you
Ankit

Re: USB Printing with OPOS Drivers

Posted: Tue May 02, 2017 5:14 am
by rdonnay
You will see similar behavior when you use the XbpPrinter() class with SET PRINTER to oPrinter.

Apparently, Xbase++ is using that driver to emulate the old DOS way of printing.

Re: USB Printing with OPOS Drivers

Posted: Tue May 02, 2017 6:22 am
by ampandya
Hi
yes, you are right.
------------------------------------------------------------------------------------------------------------------
the current code is as below;

oPrinter := XbpPrinter():new()
oPrinter:create(cPrinter)
prtstatus = oPrinter:printerstatus()
do while prtstatus != 1
if qbox("Printer is Offline!, Please check the connection.",{"Retry","Cancel"},," Status:"+str(prtstatus)) == 2
return
exit
endif
prtstatus = oPrinter:printerstatus()
enddo
SET PRINTER TO OBJECT oPrinter
SET DEVICE TO PRINT
@0,0 say TEXT+chr(13)+chr(10)
SET DEVICE TO SCREEN
SET PRINTER TO

and as below:

oPrinter := XbpPrinter():new()
oPrinter:create(cPrinter)
SET PRINTER TO OBJECT oPrinter
set printer on
set cons off
? text
set printer to
------------------------------------------------------------------------------------------------------------------
If i print using

@0,0 say TEXT1+chr(13)+chr(10)
@0,0 say TEXT2+chr(13)+chr(10)
@0,0 say TEXT3+chr(13)+chr(10)
@0,0 say TEXT4+chr(13)+chr(10)
@0,0 say TEXT5+chr(13)+chr(10)

it prints smooth on the usb printer, but this is not something i can use for the reports and other print outs.

i have seen other program using OPOS drivers, to use the USB POS printers,


thanks

Re: USB Printing with OPOS Drivers

Posted: Tue May 02, 2017 6:37 am
by rdonnay
I suggest using the DCPRINT system.
Try something like this:

Code: Select all

#include DCPRINT.CH

DCPRINT ON

@ 0,0 DCPRINT say TEXT1
@ DC_PrinterRow()+1,0 DCPRINT say TEXT2
@ DC_PrinterRow()+1,0 DCPRINT say TEXT3
@ DC_PrinterRow()+1,0 DCPRINT say TEXT4
@ DC_PrinterRow()+1,0 DCPRINT say TEXT5

DCPRINT OFF

Re: USB Printing with OPOS Drivers

Posted: Thu May 11, 2017 4:37 am
by ampandya
Thanks

I cannot use DCPrint for the code i have already got at the moment, let me explain.

The program used to work only on serial receipt printer, I have written for USB printers. some receipts works because i have re-design them using @0,0 say ..... that works perfect!
now there are some reports which are being designed using the memo field in the dbf file and send each line to dos_print function.

so now when i have got this in the function dos_print:

IF port!=nil .and. substr(port,1,3) ="USB" .and. NOCR!=.t.
oPrinter := XbpPrinter():new()
oPrinter:create(cPrinter)
prtstatus = oPrinter:printerstatus()
do while prtstatus != 1
if qbox("Printer is Offline!, Please check the connection.",{"Retry","Cancel"},," Status:"+str(prtstatus)) == 2
return
exit
endif
prtstatus = oPrinter:printerstatus()
enddo
SET PRINTER TO /*"tillreports.doc" ADDITIVE */ OBJECT oPrinter
SET DEVICE TO PRINT
@0,0 say TEXT+chr(13)+chr(10)
SET DEVICE TO SCREEN
SET PRINTER TO
return
ENDIF


that means it creates new print job for each line and it prints slow....

is there anyway it print smooth?

Many Thanks.

Re: USB Printing with OPOS Drivers

Posted: Thu May 11, 2017 8:06 am
by Auge_Ohr
ampandya wrote:

Code: Select all

      @0,0 say  TEXT+chr(13)+chr(10)
that means it creates new print job for each line and it prints slow....
wonder why you send a CRLF ...

Re: USB Printing with OPOS Drivers

Posted: Thu May 11, 2017 8:31 am
by ampandya
You are right,
I can take that away in this case. It was there for the receipt function i wrote to print receipt within one go.

can you give me any idea to work with USB printer in this situation, I heard many other pos software use OPOS drivers to deal with USB devices?

Thanks