Solved

Need to spool printer output and have it redirected to another program's stdin for manipulation

Posted on 2003-12-01
8
513 Views
Last Modified: 2013-12-03
We have a Unix-based accounting system that we use, and part of our ability is to spool the output of a printer operation and have it piped to another program.  We have scripts that take this output from stdin, manipulate it, and then print it to a printer of our choice.  We essentially have full control of our printing operations.

I need to create the analog for Windows (NT 4.0, 2K, ...).  I have made use of RedMon, and although it's proven useful in spooling the printer output and piping it to my program, it still makes use of a printer driver.  The problem with this is that I can't find a printer driver that does NOT adulterate the output; indeed, even the Generic Text driver likes to add the filename of that which was printed on the header, and the page numbers on the footer.

So, to recap: I need to have a printer operation's stdout pipe to the stdin of my program.  My program will then print to the necessary printer.  Is anyone aware of any truly Generic Text driver that doesn't modify the data sent to the printer in any way?  Any other suggestions are GREATLY appreciated!
0
Comment
Question by:BitTwiddler
[X]
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
  • 3
  • 2
8 Comments
 
LVL 10

Expert Comment

by:ADSaunders
ID: 9851103
Hi BitTwiddler,
This is what you need: http://www.cs.wisc.edu/~ghost/redmon/

Regards .. Alan
0
 

Author Comment

by:BitTwiddler
ID: 9851150
Thanks Alan.  I noted in my question that I've used RedMon, and it gets me *almost* where I need to be.  The trouble is with the fact that RedMon still wants a printer driver to be associated with any printer that uses the redirected port created by RedMon.  The Generic Text driver still modifies the data, so by the time my program receives it extra data has been added.

Worst-case scenario, I would use regular expressions to remove the junk that the Generic Text driver adds, but I'd really like a "raw" text driver that simply doesn't modify the data.  I'm also open to other ideas.

Thanks for the reply!
0
 
LVL 10

Expert Comment

by:ADSaunders
ID: 9851184
I had this problem some while ago (previous employment) I did it by linking redmon through another driver that did little but select the printer and font, and pass on the incoming text. b****red if I can remember what it was called though.
I'll see if I can drag up any more info.
0
 

Author Comment

by:BitTwiddler
ID: 9851936
I'll up the points in hope of more interest :)
0
 
LVL 10

Accepted Solution

by:
ADSaunders earned 500 total points
ID: 9852429
Hi,
I found it! Don't know whether it'll solve your problem however. At the time (April 1999) we had a problem with *Nix style software on a WinNT network. Like you, we needed to print a plain text stream, but managers had bought cheaper Windows Only printers. (i.e. no firmware printing engine, had to be driven through Windows) The following is the solution I came up with, and posted (I think) in the HP Support forum at the time.
-------  SNIP ------------

At Last! a solution to Print Performance Architecture (at least sufficient unto my needs).
The problem is that DOS, and legacy programs send output to a port rather than a print driver, and that PPA printers (including the HPDJ720 and HPDJ820) need to be driven from their Windows print driver.

The first partial solution exists in a program called Printfile (prfile.exe or prfile32.exe) available from http://hem1.passagen.se/ptlerup. (Now http://www.lerup.com/)
This program (which can both be run from a DOS prompt, and can print data sent on standard input) can maintain named parameter settings defining printer font layout etc (including n-up layouts), and will invoke the defined printer driver upon execution.

The second part is a port redirection monitor available from http://www.cs.wisc.edu/~ghost/redmon/index.html. This allows the creation of a 'printer' port where all data received on that port can be filtered through another program .. In this case prfile32!

The third part is mainly cosmetic, a desktray utility to quickly change the default printer.
The (free) one I use is available from {{ broken link removed -- DR / EE PE }}

Probably the most important aspect of this solution, is that all programs are actually free. Redmon is issued under the GNU public license, printfile and PrtChg are both issued as freeware by the authors.

Hope this is of some use

.. Alan
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 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