Go Premium for a chance to win a PS4. Enter to Win


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
  • 2
  • 2
  • 2
  • +3
LVL 28

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.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Printers have changed substantially in the last 30 or so years, not just in technical capabilities but in cost and usage as well.  Printers were originally used for interfacing with the operator, not necessarily for printing copy or pictures. In …
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…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

886 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