Solved

Serial Receipt Printer Issues

Posted on 2009-05-12
24
840 Views
Last Modified: 2012-05-06
Hi,

I am trying to work some final bugs out of a program we are using. The issue is that we have a receipt print out of LPT1 mapped to COM1 and the first receipt will print fine. However when we try to reprint the receipt it will sit in limbo until something else tries to print or we wait 15 seconds - 2 minutes for it to print. If we send another reprint command the first receipt waiting (second printed) will pop out and then we are waiting for the third receipt.

Code is attached below that shows the mapping. The program was written in house about 12 years ago ... may be time for a re-write if this can't be resolved.

If I do a Windows test print (generic drivers) everything prints fine through the printer as it should with no delays.

Thanks,
Ryan
@echo off
 

cd \

cd ePOS
 

cls
 

pkunzip -o update.zip
 

net use lpt1 /d

mode lpt1 = com1	

mode com1: 9600,E,7,1

net use lpt1 \\DTCASH1\slip /persistent:no
 

epos

Open in new window

0
Comment
Question by:Ryan Rood
  • 9
  • 8
  • 5
  • +1
24 Comments
 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 166 total points
ID: 24369857
Hmm, only thing that springs to mind is whether Windows is spooling the job.... i.e. in the printer setup in Windows do you have it set to "print directly to the printer" in advanced tab?  

Not sure where the net use lpt1 comes in... is the app printing to lpt1 which is redirected to com1?  Is the printer physically attached to com1 or printed over the network etc?

Listening for other answers for myself!

Steve
0
 
LVL 1

Author Comment

by:Ryan Rood
ID: 24370221
Hey Steve,

I have tried to change the printer to print directly and not spool .. however nothing works then. The app scans for the printer when attached but will fail if I tried to change this. The printer is physically attached to COM1 but the app will not allow printing through COM1 and will fail when launching ... it must be redirected through DOS when launching the program.
0
 
LVL 28

Accepted Solution

by:
Bill Bach earned 167 total points
ID: 24370618
The program was written 12 years ago -- is it a DOS or a Windows application?  You don't specifically state, but you tagged the question with "DOS POS", so let's assume that you have a DOS app.

First, the problem is likely the print spooler, as recommended by dragon-it.  In the old days, we had NetWare, and NetWare had a great DOS command called CAPTURE that would allow you to set a timeout value -- when there was no more output after a given amount of time (usually about 30 seconds), the spool file was closed and the data was pushed to the printer and the print spooler reset for the next user.  This allowed multiple users to redirect their print jobs very easily.  

Unfortunately, Microsoft doesn't WANT to allow DOS users to print easily (as it means that they are not running Windows applications).  This means that the same functionality is a lot harder to come by.  My own recommendation is to get a license of DOSPRN (www.dosprn.com/).  This little gem will allow you to redirect output from ANY DOS device (i.e. LPT1) and redirect it to ANY Windows printer driver -- including any share and even to USB-based printers.  It makes it possible to extend the life of your old applications by printing right to modern network-attached laser printers if you want to, too!

Of course, DOSPrn has its own timeout value, so you still set it up the same way, but it simply takes all of the work out of printing from DOS applications, and it is well worth the low cost investment.
0
 
LVL 1

Author Comment

by:Ryan Rood
ID: 24370651
Hello BillBack,

Thanks for the suggestion, I gave this a wirl a while back when I was first faced with this issue ... I will take another stab at it. So you are suggesting that I send the output from the program to a random (lpt4) and then have DOSPRN capture this port and send it through the Windows print spooler where the driver is working correctly I might add.

Will give it a try and let you know in the next few days the outcome of this.

Thanks!
Ryan
0
 
LVL 28

Expert Comment

by:Bill Bach
ID: 24371209
Doesn't need to be a random port - LPT1 should be fine. But YES, set up a DOSPRN trial and see if that works for.
Be sure to adjust the timeout value, in the GUI config screenN too.
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 24371571
Agreed wit all that!   Still don't quite see why you have a net use to capture lpt1 to the shared printer then also lpt1 mapped to com1 though?!

Timeouts aside, I would have thought windows needs to know it is a com1 printer and then use net use to map to that share?

Anyway I have heard of people using dosprn before but never got around to trying it myself - I have normally just got away with net use to shared printer.
0
 
LVL 1

Author Comment

by:Ryan Rood
ID: 24375898
No go ... when trying to use DOSPRN it just sends garbage to the program ... and then it errors out because of jibberish being entered on the screen. Once the program was removed it returned to normal.

Back to the drawing board on this one.
0
 
LVL 28

Expert Comment

by:Bill Bach
ID: 24375982
I have to ask this, just for completeness -- did you:
1) Set up a normal Serial **Text-Only** Printer driver in Windows (that works)
2) Remove all of the LPT1: and COM1: mappings
3) Use DOSPRN to set up the mapping to the Windows driver

0
 
LVL 1

Author Comment

by:Ryan Rood
ID: 24376467
Checking now ... I hadn't removed the mappings yet ... but now I have.

Not really working ... I am re-enabling the LPT port in hopes that it needs a real port to scan for data ... keeping in mind that I can't set the program to print to COM1 ... I would still need a redirect from COM1 - LPT1.

Agreed?
0
 
LVL 28

Expert Comment

by:Bill Bach
ID: 24376562
Agreed.  In Windows, you should set up the printer so that it works there FIRST.  Add a new LOCAL printer, and then specify the COM1 port.  When you get to the driver, select Generic on the left and then "Generic / Text Only" on the right side and create the printer like that.  You can test this by using NotePad to print out a test message of some sort -- it should work.

Once you've got that, try linking DOSPRN to THAT Windows printer.  I think this is what dragon-it was getting at -- if you had a valid Windows printer defined, then the simple redirection of LPT1: to the windows printer should have been sufficient, eliminating the need to mess with the com port redirection in the first place.  You may wish to even try this without DOSPRN, too, to see if that works.  If so, it'll save you a step.  
0
 
LVL 7

Assisted Solution

by:LANm0nk3y
LANm0nk3y earned 167 total points
ID: 24376621
I don't think you need these lines

mode lpt1 = com1
mode com1: 9600,E,7,1

since you're using the network to redirect printing anyway.  Windows network will take care of the redirection.  As far as the comm port settings, you should do this in the device manager.  Give that a try and see if it works.  

0
 
LVL 1

Author Comment

by:Ryan Rood
ID: 24376670
Ok. Printer is working ... however even with the timeout set to 1sec ... it is still taking about 10 - 30sec before it is starting to spool the receipt in the print spooler. Something is causing it to wait ... I want the receipt to be able to print almost instantaneously.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 7

Expert Comment

by:LANm0nk3y
ID: 24376735
0
 
LVL 7

Expert Comment

by:LANm0nk3y
ID: 24376748
my bad, that won't work because it's on a comm port.  Let me see if I can find anything out there.
0
 
LVL 28

Expert Comment

by:Bill Bach
ID: 24376834
Did you try setting the timeout on DOSPRN to 1 second?
My guess is that the standard Windows queue won't be modifiable, but there might be a hidden registry setting to adjust the timeout...

0
 
LVL 7

Expert Comment

by:LANm0nk3y
ID: 24376846
Alrighty, sorry about that.

I would try the andtechnologies.com dosprint program and see if that works.  Another one that looks good is printfil: http://www.printfil.com/edown.htm
0
 
LVL 1

Author Comment

by:Ryan Rood
ID: 24377277
alright ... tried printfil ... same issue. This one appears to start working much quicker (icon changes color to indicate data) ... but it still sits and waits for about 15 seconds before sending to the spooler ... and then will print within the next 15 seconds.
0
 
LVL 7

Expert Comment

by:LANm0nk3y
ID: 24377944
The other thing you could try is modifying the printer settings to print directly to the printer instead of spooling.
0
 
LVL 7

Expert Comment

by:LANm0nk3y
ID: 24377962
I tried attaching the screen shot, but if you go to the printer properties, under advanced you'll see the option.
0
 
LVL 1

Author Comment

by:Ryan Rood
ID: 24378293
I have tried this ... same reaction - document is sitting somewhere before printing is attempted. When this option is enabled sometimes I get an error about not being able to print - probably because the port is in use.
0
 
LVL 7

Expert Comment

by:LANm0nk3y
ID: 24378402
Can the printer baud rate be changed?  Maybe a faster buad rate will fix your problem.
0
 
LVL 1

Author Comment

by:Ryan Rood
ID: 24378597
Baud rate can't change, this device is shared between two serial sources. One from POS system (db25 serial ethernet) and computer (serial hardware switch) to switch between the two sources.
0
 
LVL 7

Expert Comment

by:LANm0nk3y
ID: 24378719
Hmmm couldn't you simply just go into the POS system and direct the receipt printer to the com port instead of it going through the PC and then back to the com port.

Another thing you could try is removing the switcher and just use one or the other.  I don't think this is the cause, but just to narrow down the issue.
0
 
LVL 1

Author Comment

by:Ryan Rood
ID: 24378782
POS system is company wide, clients can connect via ethernet or serial ethernet with db25 adapter. There is no way to change printer redirection. The optimal resolution to this is network receipt printers, but they are 700$ each ... can't justify the cost right now for each store.

Oh well, back to the old fashion way.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now