FoxPro DOS (yes, DOS) and those new-fangled printers

I have an ancient FoxPro DOS app that churns out reports in a way that can’t be done too easily (not worth a rewrite) in Windows. It used to print these on an HP LaserJet II (back in the days when we listened to music on those big flat round discs with a needle) and has been printed on a LaserJet 4Si for about 12 years or so. I just got a sweet little LaserJet 1320t and expected all of this printing (which is done in PCL) to continue to work. But it didn’t – at least not without some sweat and tears – and I had a few lessons to learn.

1) The new printers are very special and create their own ports on Windows for printing. I finally realized that to print from DOS at all, whether a print command from the DOS prompt or from within FoxPro, I needed to change that to LPT1. (And have to remember to switch back for all of my other printing.)

2) Somehow my application was communicating enough to the printer by saying “legal paper, please” that the printer would find the right bin, even if I moved the legal tray to the upper bin or the lower bin. With the new printer, I needed to explicitly send the PCL code for legal paper and lower bin (esc&l3A  and esc&l4H)

3) My reports were printing out based on 117 lines per page (legal) . I could no longer get that to work (two hours was enough time spent on that problem, wouldn’t you say?). So I had to accept sticking with 102 lines and 8 lines per inch. I literally print this report using line and column #s for positioning, so this is a big deal for me. Of the 400 reports that get printed (one per entity), not too many of them needed that full length, so I will just have to keep an eye out for those and make sure the two page functionality I have built into this program works properly.

Hopefully this will help some other dinosaur who is moving partially to the modern ages (funny that I have one foot in the dark ages and the other dipping into the bleeding edge with the rest of my work). As long as Raymond Chen and team continue to allow me to use this reporting tool on Windows XP and beyond, I have no incentive to try to duplicate the process in windows.

Don’t Forget:

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.