Sunday, July 3, 2011

Virtual LTP1 for USB Printer

Another interesting day. I faced a typical trouble when running old legacy software on new hardware. This time the issue is with the printing. The legacy software requires lpt1 connection to do the printing, which the new hardware does not have.
This should be simple if there is a configuration menu for choosing the appropriate printer, unfortunately there is not.
Another thing that makes it a little bit complicated is, it uses raw ESC command, instead of using the printer driver to print.
In this case, somehow I need to make the legacy software sees and uses lpt1.

Now, the solution is to add the printer, which uses USB, so it will work correctly. Now, the trick is to use a generic text printer as the driver instead of the actual printer's driver. That solved the raw ESC command.
Nex step, share the printer. Then, redirect ltp1 to use the usb connected printed configured previously. To do that, go to command prompt and type the following command:
c:\> net use lpt1: "\\computer_ip\\name_of_the_shared_printer" /persistent:yes

At this point, the lpt1 is available for the legacy software to use.