Goal
Create PDF files instead of real printing (save some trees) from legacy DOS applications that output to HP's PCL format on lpt1 port
Scenario
- DOS application prints directly to lpt1 port in HP's PCL format
- No real printers having PCL capability installed
- Install a PCL capable printer under Windows XP such as HP's LaserJet 6L even though you don't physically have the printer.
- Go to Printers and Faxes under Control Panel and select properties of the newly installed printer. Under Ports select FILE: - this will make the printer print to file
- Enable sharing on the printer and give it a share name such as HPLJ
- Open command prompt and type net use lpt1 \\foobar\hplj (where foobar is your computer's name)
- Open command promt, create a test file (for example test.txt) and check if the above is working by giving print test.txt at the promt. A pop-up window will appear asking for file name, give a name such as c:\test.prn and check that the file has been created. If this works, the printing to file is working as expected.
The above creates a PCL printer that prints to a file and thus it is not necessary to physically have the printer. We redirect all output to lpt1 from the DOS application to this shared printer which then prints it to file.
Procedure for converting the PRN to PDF
Follow the detailed procedure as shown at http://evelands.net/evan/win32gnu09.php but I couldn't get the right-click menu stuff working. So I always use the command pcl2pdf input.prn output.pdf on the command prompt. If you don't want to compile or don't know how to compile you can download the GhostPCL windows binary from http://www.truong.id.au/node/97
Recap
Use Ghostscript and GhostPCL to convert PCL formatted files to PDF. It worked fine even with DOS applications printing complex graphical plots using PCL.
Side Note
If you work exclusively on the DOS OS and don't have networking installed you can downlaod the prindir utility from http://www.simtel.net/product/view/id/49062 to redirect the lpt1 port to a file. I tested with the following command c:\utils\prindir /c - this installs prindir to memory and then redirect lpt1 to file report.prn by c:\utils\prinmod /GET1 /PUT9 /FILE-c:\report.prn (as I put the files under directory utils). Please note that prindir is not a free software, hence I only used it for testing purposes. I don't use it anymore. There are heaps of port capture softwares for DOS but none worked with PCL files as outputed by my legacy DOS application except for prindir. Please note that this procedure will not work with Windows XP or later versions since now the OS doesn't allow direct hardware access to applications. It might work with Windows 95 and Windows 98 but I have not tested it.
No comments:
Post a Comment