Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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

Posted on 2013-01-10
Medium Priority
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!
Question by:alvarovicente
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +3
LVL 27

Accepted Solution

Sinisa Vuk earned 501 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.
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):
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
LVL 39

Expert Comment

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?
LVL 16

Expert Comment

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.
Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.


Author Comment

ID: 38767574

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


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.


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

Thanks again Experts!!
LVL 16

Expert Comment

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).
LVL 21

Assisted Solution

developmentguru earned 498 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.
LVL 39

Assisted Solution

hdhondt earned 501 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.
LVL 21

Expert Comment

ID: 38770868
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...

Author Closing Comment

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

Thanks for your input!!

Expert Comment

ID: 41483764
Hi alvarovicente,

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

Expert Comment

ID: 41483767
hi alvarovicente,

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

Featured Post

Plug and play, no additional software required!

The ATEN UE3310 USB3.1 Gen1 Extender Cable allows users to extend the distance between the computer and USB devices up to 10 m (33 ft). The UE3310 is a high-quality, cost-effective solution for professional environments such as hospitals, factories and business facilities.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In an interesting question ( here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

670 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