Solved

How to intercept a print job convert it to plain text and print.

Posted on 2013-01-10
11
4,081 Views
2 Endorsements
Last Modified: 2016-02-27
Dear Experts,


I need some advice and tips for a new project i want to start.

I will be working with several bars and restaurants for a loyalty program.

Since all the customers already have a POS Software/Hardware from different vendors, i need to write a program to be able to capture in plain text the final invoice when the POS prints the final receipt.

The process should be something like:

1. The user send the command to the POS software to print the final check
2. The program will intercept the printing job, and create a plain text file and store it into the local PC.
3. The check is printed automatically
4. This should be done in silent mode, the user should not notice anything different.

My questions are:

1. Is this possible to do with POS printers like the ESPONS TM family printers?
2. First i want to build this for windows xp to windows 8
3. Which programming language is more suitable for this task, i can use C# and Delphi

I will give the max point available!!!

Thanks Experts!
2
Comment
Question by:alvarovicente
  • 2
  • 2
  • 2
  • +3
11 Comments
 
LVL 26

Accepted Solution

by:
Sinisa Vuk earned 167 total points
ID: 38765263
As I see here, you want to make "driver" - application which stands between printer and pos software. You will parse intercepted text or just store to disk?
There are few things which I can recommend here.

1. Make (or buy) com port splitter or virtual com port.
http://www.fabulatech.com/serial-port-splitter.html
http://www.eltima.com/products/serialsplitter/
http://www.eltima.com/products/vspdxp/
http://www.marshallsoft.com/wsc4d.htm
POS sw will connect to splitter  virtual com port, send text, you capture it, make changes and send to real port ....

2. You can use little hw for this (splitter cable, multi com port pci-e card):
http://www.youtube.com/watch?v=qnQtRbD-KrI
http://www.pccables.com/00828.html
Splitter cable can be connected to com1 , one split line goes to com2 and second to real printer. Your application can listen on com2.

- all can be done in c# or Delphi, from xp to win8
- it is not depending on printer - almost all printers can emulate Epson commands
0
 
LVL 38

Expert Comment

by:hdhondt
ID: 38766351
I don't quite understand what you want to achieve. The way I see it you want the user to print a cheque, then extract the text data from that cheque and print it as a cheque. So what's wrong with the first cheque?
0
 
LVL 16

Expert Comment

by:DansDadUK
ID: 38766514
Also note that some printers just receive and print a raster image (the printer driver having converted text to raster), and have no concept of text data.

You'd find it quite difficult to extract text from such images.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:alvarovicente
ID: 38767574
Sinisav:

I will try your solution. Yes I need to parse the text at some point for futher processing.

hdhondt:

Im writing a loyalty software, since many of my customers have different POS software and I dont have access to their source code, i want to just intercept the receipt when this is sent to the POS printer, in text format, so I can parse it and depending on the loyalty program rules, do further processing with the invoice information, using this method y believe i can reach almost any customer no matter what POS vendor they have installed. Let me know if you get my idea.

DansDadUK:

So this always happens with POS printers? There is no way to capture before this is rasterize?

Thanks again Experts!!
0
 
LVL 16

Expert Comment

by:DansDadUK
ID: 38767606
>> ... So this always happens with POS printers?  ...

I've no idea if this happens with any, all or some POS printers - but it may do!

... and the only way to capture the text would then be before the printer driver rasterised it, so it would be no use capturing the output being sent to the printer port ( unless you are planning on writing an OCR function).

Even if the printers you are targetting accept text characters, these are almost bound to be interspersed with printer control sequences (to move cursor, select font, etc. etc.), so you'd have to have a knowledge of the (perhaps several) printer languages (e.g. Epson ESC/P) in use in order to be able to properly parse the print stream and extract the text (ignoring the printer control sequences).
0
 
LVL 21

Assisted Solution

by:developmentguru
developmentguru earned 166 total points
ID: 38767948
I have seen companies that wrote a printer driver... for no printer.  The printer driver would, instead, produce a PDF file.  Any software, using the basics of windows printer APIs, could print to this non-printer.  It seems to me that this would be an ideal place for you to start.  I would start the project by making a working printer driver and make that printer driver capable of being set up to pass all instructions (without change) to another printer driver.  In the meantime your printer driver could do... whatever you need to do with the data.  Some programs may send the printed receipt to the printer as a bitmap.  The only way around this would be to incorporate OCR software.  This has already been mentioned in other questions, just added here for completeness.

Some of these printers may not be set up as a windows printer at all, and may be a custom COM or Parallel port device that is proprietary to the vendor.  If you find this to be the case the the scenario you have been pushing for may not be feasible.

You may find it easier to extract data from the POS software's database, or data export functions.  If you can make this type of setup for each vendor then this would be FAR easier in the long run.
0
 
LVL 38

Assisted Solution

by:hdhondt
hdhondt earned 167 total points
ID: 38770793
If they all use the same printer, and if that printer uses something like PCL or ESC/P then it is possible. You would still have to set up the PCs to print to a file instead of to the printer port. If the printers only support some form of raster image, then there is no text that you can extract.

Perhaps your best solution is to get the users to use the Generic/Text Only driver, connected to FILE:. That way everything is consistent, and you're guaranteed to be working with text.
0
 
LVL 21

Expert Comment

by:developmentguru
ID: 38770868
@hdhondt
Not a bad idea, for the data handling side, but... he will still need to have it come out of their printer of choice... looking the way it always looked...
0
 

Author Closing Comment

by:alvarovicente
ID: 38794872
Experts, i will try from all your suggestions, it will take some time to test.

Thanks for your input!!
0
 

Expert Comment

by:bubble_dl
ID: 41483764
Hi alvarovicente,

What's your approach to this problem? If you have anything to share. Thanks
0
 

Expert Comment

by:bubble_dl
ID: 41483767
hi alvarovicente,

what approach you pick to tackle your problem? if you have share some ideas.  Thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
rest webservice call over https via c# 6 37
Problem!!! 8 33
Call windows 10 virtual keyboard from windows forms app 2 32
tableview is not updating 1 6
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

813 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

14 Experts available now in Live!

Get 1:1 Help Now