Printing to file from DOS

DaneInUS used Ask the Experts™
I have a user who is running a custom application written sometime last century...  It runs in a DOS prompt under XP.  
The application does some calculations and prints reports of these on a printer hooked up to LPT1.  It would be very beneficial if the print somehow could be routed to a file so it could be e-mailed.
Anybody out there with ideas?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Paolo SantiangeliConsulente Informatico

Have a look here:
This basically does what the program above does, but manually by installing the MS Loopback Adapter.

It involves a few steps, adding the virtual adapter in XP, creating creating and sharing the virtual printer you're going to use for print to file, running the NET USE command to capture the LPT1 port and route it to the virtual printer you've set up, and that's about it. It's free, but involves a bit of setup.

To setup a virtual file printer, follow these instructions but share it with a name so it can be pointed to after capturing the LPT port.

The steps to install the MS Loopback Adapter, capture and redirect LPT1, and etc, etc. You'll be using a virtual printer rather than one connected to the USB port though.

Good luck! ;)
You'll only be creating once, even though somehow I typed it twice... lol.
How to Generate Services Revenue the Easiest Way

This Tuesday! Learn key insights about modern cyber protection services & gain practical strategies to skyrocket business:

- What it takes to build a cloud service portfolio
- How to determine which services will help your unique business grow
- Various use-cases and examples

If you just capture the print output, email it, and print it on the same kind of printer at the email receipient's end, just capture the print to a file as @BlueThuda suggests.
If you expect the email to contain viewable laid-out pages like an ebook that can be viewed on screen and not printed, well that is something else entirely, and @psantiangeli suggestion could help solve it then.

The other big consideration, if the DOS program sends out mostly just text output, or if it was architected to output complex forms using line-drawing or postscript or PCL?

Usually you have to "tell" the DOS program what kind of printer so it invokes the correct codes, be it Epson ESC codes, HP PCL codes and downloads, or PostScript (PostScript printing is largely what PDF creation is based on) or whichever somewhat proprietary print language, to the printer.  Which is yours using?

Many printer manufacturers supported their older commands, except for the "windows only" type printers that only do "GDI"

A straight capture-to-file will mean you have a file that contains the printer output command codes and all, so the more complex outputs could be repleat with printer codes.   If the output is super simplistic printing just characters and spaces 80 characters across one line at a time, the directed to file output should be fairly readable with notepad.  If it's complex, can you instead "dumb down" your output by configuring the old DOS program to think it is printing to a fairly plain printer?  If so, @BlueThunda's steps and view with notepad or such.  Either that, or you need an emulator to translate, @psantiangeli's suggestion.

If the program exploited laser-printers ability to download into memory exceedingly complex line-drawing forms to be put on the page with nothing but a subsequent call of an escape code and downloaded form number, or if it depended on such a "cartridge" being inserted in one of the printer's cartridge slots, then the emulator may not be able to execute that, but printfil does have an ability to add logos or overlays via bitmaps and such, which in theory could accomplish the form generation if a blank form is captured as an image file.


Can you helkp me award the points for this question, please?
I'd like to award 65 to BlueThunda and 60 to OCanada Techguy.
Top Expert 2009

I've requested that this question be deleted for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.


Can you helkp me award the points for this question, please?
I'd like to award 65 to BlueThunda and 60 to OCanada Techguy.  

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial