[WinPrnDev] Re: Intercepting data sent to the printer

  • From: "Christoph Lindemann" <Christoph.Lindemann@xxxxxxxxxxxxxxxxxxx>
  • To: <winprndev@xxxxxxxxxxxxx>
  • Date: Thu, 1 Dec 2011 09:36:50 +0100

Hi Akshay,

 

It depends on how the applications interfaces the printer, direct or GDI
(as I wrote in my previous post).

 

About Redmon on Win7:

http://stackoverflow.com/questions/3433382/cant-add-new-redirected-port-
in-windows-7-after-installing-redmon

https://github.com/jonasoberschweiber/redmon

Google for "Redmon windows 7"

 

 

Best regards,

Christoph

 

________________________________

From: winprndev-bounce@xxxxxxxxxxxxx
[mailto:winprndev-bounce@xxxxxxxxxxxxx] On Behalf Of akshay gupta
Sent: Thursday, December 01, 2011 9:17 AM
To: winprndev@xxxxxxxxxxxxx
Subject: [WinPrnDev] Re: Intercepting data sent to the printer

 

Hi Christoph,

First of all thanks for all your valuable suggestions.I will now share
with you some of my experiences trying to figure out what to do based on
your suggestions. I read about esc/p2 printer language , its basically a
set of printer instructions instructing the printer how to choose
fonts,set printing area, setting printing positions and lot other
things.I found a tool printcapture http://printcapture.com/index.html
<http://printcapture.com/index.html>  which would read epson printer
format and render the file content as an image.I tried opening the print
to file output from EPSON TM-T88IV with this tool , but it could not
open it.This led me to thinking that the format is not exactly esc/p it
could be some variation,because when I open that file in hex editor I
can see some of the  esc character commands listed in the programers
manual.Now my question is how can I extract readable text from the file
containing esc character commands, is there any library that do this
kind of work? Or Is there some way for me to intercept and interpret
the data before it is sent to  the Epson printer driver? Because doing
this I would remove my dependency on Epson printer divers and also I
would save myself from first interpreting the esc character commands
then encoding the edited text back to the esc character commands.

PS : I could not try using QPCPrint as setting it  up require redmon
which does not work for windows 7 :-( .


Regards,
Akshay
  
 






On Tue, Nov 29, 2011 at 2:40 PM, Christoph Lindemann
<Christoph.Lindemann@xxxxxxxxxxxxxxxxxxx> wrote:

Hi Akshay,

 

The data stream is probably encoded as Esc/POS, a variation of Esc/P or
Esc/P2.

http://www.undocprint.org/formats/page_description_languages/esc_p2

 

You can try the following tool

QPCPrint http://www.kilgus.net/qpcprint/index.html

QPCPrint is an emulator that accepts input in ESC/P2 format, be it text
or raster graphics, and outputs the result to any Windows compatible
printer. The emulation has a precision of 1440dpi and matches the output
of a real printer extremely well.

 

If the third party application prints directly to the printer, without
using the Windows printer driver, then you can do your own application,
which modifies the Esc/P data. You can get reference manuals at the
Epson Developer website.

 

If the third party application uses GDI and the Windows printer driver
(You could check that by testing if the application can print to any
printer installed in windows. For example a HP LaserJet.). Then you
could build your own virtual EMF printer driver, or license one of the
many available EMF printer driver SDK's:

http://www.colorpilot.com/emfprinterpilot.html

http://www.verypdf.com/artprint/mini-emf-printer-driver.htm

http://www.blackice.com/Printer%20Drivers/EMF%20Printer%20Drivers.htm

 

 

Best regards,

Christoph

 

 

________________________________

From: winprndev-bounce@xxxxxxxxxxxxx
[mailto:winprndev-bounce@xxxxxxxxxxxxx] On Behalf Of akshay gupta
Sent: Tuesday, November 29, 2011 9:30 AM
To: winprndev@xxxxxxxxxxxxx
Subject: [WinPrnDev] Re: Intercepting data sent to the printer

 

Thanks for quick replies, Ill tell exactly what i want and what i have
tried till now.

What I want : 
There is a third party application whose task is to generate a document
(which is sort of a bill) and after generating it, it prints that
document. Now I want to some how get the text that printer will
printing  before it actually prints it, and modify it and send the
modified text back to the printer.

What I have tried: 
I have Experimented with  EPSON TM-T88IV Receipt printers.
1) I first though that I would print to a file and then read and edit
the contents of that file and send it to the printer for printing. But
the file that it created didnt contained what I expected. It had
unreadable data which I had no idea how to convert it to a readable
format.

2)I tried hooking to the com port and intercept the data that is flowing
through it. But again all I got was a stream of unreadable data.

Regards,
Akshay 

On Tue, Nov 29, 2011 at 1:25 PM, Christoph Lindemann
<Christoph.Lindemann@xxxxxxxxxxxxxxxxxxx> wrote:

Hi Akshay,

 

Check out the Windows Driver Development Kit (WDK) documentation about
how the print spooler is working.

 

The available options depend on how the application is sending data to
the printer, and what you are trying to accomplish. Is the application
using the GDI API to render the job, or is it sending the data directly
to the printer? Do you want to capture the print like a virtual printer?
Or do you just want to "listen" to the job data, but the data should
still go to the printer? Do you want to modify the data stream? What
type is the printer?

 

I think it would be best, if you give us more context information,
describe what you want to accomplish? Why? And what your own ideas are,
on how to do this.

 

Best regards

Christoph

 

________________________________

From: winprndev-bounce@xxxxxxxxxxxxx
[mailto:winprndev-bounce@xxxxxxxxxxxxx] On Behalf Of akshay gupta
Sent: Tuesday, November 29, 2011 8:32 AM
To: winprndev@xxxxxxxxxxxxx


Subject: [WinPrnDev] Intercepting data sent to the printer

 

Hi,



I am working with an application that prints to a thermal POS printers
in windows environment.
Can somebody please tell me how can I get the actual text(readable)
after a print command is fired from that application. I have no control
over the code of that application therefore I want to do it at the
spooler level or at the driver level , or some how interpret  the data
flowing through the COM port.

Regards,
akshay

 

 

Other related posts: