Living without Windows!by Jos Visser
Part 4: I print some letters
Approximately once a week I process all the snail mail that Anita (one of our neighbours who also happens to be the PTT POST mail delivery person for our neighbourhood) dumps on our door mat. I usually do this Sunday or Monday evening. In the enormous pile of stuff that I then have to go through I can usually bet on finding one or more letters from the Dutch Tax Service and normally my accountant throws in one or two as well. As you can probably imagine, this in return prompts me to write some letters to the both of them in an attempt to try and regulate the flow of money going from me to the tax man's coffers. In my new, Window-less, world, writing these letters is a new challenge to rise up to!
Writing the letters themselves proves pretty hassle free. I start ApplixWare and within just a few minutes I have two ".aw" (Applix Words) files containing letters that should keep the sharks of the Tax Service at bay for some time. Now, how about printing them so they can be faxed and sent?
I happen to own a Brother HL-6 laser printer that I normally use for printing small fry documents. It is rather old and a bit worn down, but for printing the odd few-page letter it still suffices. This printer (called "Drukker1") is physically connected through a Centronics parallel connection to my desktop PC on the 2nd floor in the study. When working with my laptop I usually do so sitting at the dinner table in the living room, which is located on the ground floor. The Home Area Network in Zeewolde does not yet stretch from the living room to the study, so some "Adidas networking" is obviously called for. Using the "mcopy" command I copy the two Applix Words files to a floppy and I walk two stairs to the study. The desktop PC is still running (amongst other things) Red Hat Linux 5.1 and ApplixWare, which I never bothered to remove after the initial tryout mentioned in part 1. I booted the PC, started X-Windows, copied the files from the floppy to the hard disk (using "mcopy" again), started ApplixWare and loaded the files in ApplixWare's word processor.
I knew the printing features of ApplixWare are rather limited. As far as I can see it only supports PCL5 and PostScript output to either a configured Linux printer or to a file on the hard disk. Now I could remember that my Brother printer was somewhat PCL compatible and I had also seen that the Red Hat installation procedure had created a default print destination called "lp". Why not try the dumb approach and just print the document as PCL5 on "lp"? Well, having done so, nothing happened. The printer stayed completely silent and there were no printer LEDs blinking (obviously no data arriving there). Hmmm,.... had the document arrived in the printer spooler queue in the first place? Using "lpq" solved that: yes it had. Another "lpc status" told me that no printer spooler daemon had been started. Ok, "lpc start lp" then. Hold on! It now told me that the daemon was waiting for the printer to become online, which in my opinion it was (a bright orange LED on the front of the printer tells me so).
Time then for some real UNIX system administration: what device file was the "lp" destination attached to. A look at "/etc/printcap" told me that the device file was "/dev/lp0". Well, this sounded right. Was the lp parallel driver configured in the kernel? Usually in FreeBSD device drivers and devices announce themselves at kernel initialisation time and I thought I knew that Linux did something like that as well. "dmesg | grep lp" told me that two parallel devices were configured: "lp1" and "lp2". Would the primary parallel port then be "/dev/lp1" instead of "/dev/lp0"? Strange, all of "/dev/lp[0-2]" existed? Well, why not try "/dev/lp1" then:# vi /etc/printcapAnd voila, the printer lights started blinking, and then ............., nothing :-(.
... change the device file of the "lp" destination to "/dev/lp1"
# lpc restart lp
In my experience, a printer receiving data but then refusing to print something can usually be attributed to a missing "EJECT" instruction in the data stream. The page is then still in printer memory and needs just a little convincing to come out: take the printer offline and press the "form feed" button. A page appeared allright, but it unfortunately bore only the slightest resemblance to the letter I had expected to come out.
Well, maybe my printer is not so PCL5 compatible as I had hoped. Time for another trick then. I knew that the Ghostscript package contained a program called "gslj" that can convert PostScript to PCL. Maybe the output of "gslj" conforms to a somewhat more ancient PCL that is also understood by my Brother HL-6. I started off and printed the letters in PostScript format to two temporary files, "/tmp/aap.ps" and /tmp/aap2.ps" (if you ever come across files named "aap", they're mine, they're temporary and they can be removed). Ok, two letters, in PostScript files, ready to be printed!
The use and syntax of the Ghostscript programs however has eluded me for many years now and I did not feel like researching their exact use right now. Fortunately there also exists a Ghostview program ("gv") that offers a nice graphical user interface and which instructs the Ghostscript software to render PostScript files on a page by page basis. Both Ghostview and Ghostscript happened to be installed on my RH5.1 powered desktop machine. Hurrah, the end is in sight! Ghostview opened both PostScript files flawlessly and when I pressed "Print" it asked me with what "lpr" command I wanted to print the documents. Well, there is only one configured printer in the system and I could not think of any other "lpr" options so I just pressed "OK", hoping that Ghostview would magically and all by itself render to PCL. (As you will probably have guessed by now, I am not one for careful examination of the documentation.) The printer lights blinked, et voila, the letters appeared! They looked somewhat strange to someone who is accustomed to Microsoft Word, but in all objectivity they looked fine and were ready to be signed, sealed and sent.
Now, obviously, if I am to print some more in the future, this procedure needs to be adjusted. It is way too tiresome to print each letter I write in this here three-step process. Maybe I should create a new printer spooler destination with a filter script that runs "gslj" with the correct options? Or I could perhaps write an ApplixWare macro that performs this trick entirely from within ApplixWare? I have also read something somewhere about a printer filter called "apsprinter" or "apsfilter" that perhaps could assist me. Definitely something I need to look into! However, right now "xearth" tells me it is around mid-day in Tahiti. Time to sign off!