USB Printing with OPOS Drivers

Xbase++ 2.0 Build 554 or later
Post Reply
Message
Author
ampandya
Posts: 58
Joined: Tue Apr 19, 2016 4:48 am

USB Printing with OPOS Drivers

#1 Post 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

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

Re: USB Printing with OPOS Drivers

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

ampandya
Posts: 58
Joined: Tue Apr 19, 2016 4:48 am

Re: USB Printing with OPOS Drivers

#3 Post 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

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

Re: USB Printing with OPOS Drivers

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

ampandya
Posts: 58
Joined: Tue Apr 19, 2016 4:48 am

Re: USB Printing with OPOS Drivers

#5 Post 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.

User avatar
Auge_Ohr
Posts: 1406
Joined: Wed Feb 24, 2010 3:44 pm

Re: USB Printing with OPOS Drivers

#6 Post 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 ...
greetings by OHR
Jimmy

ampandya
Posts: 58
Joined: Tue Apr 19, 2016 4:48 am

Re: USB Printing with OPOS Drivers

#7 Post 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

Post Reply