Living without Windows!

by Jos Visser

Part 8: I print again

Go back to the index

Introduction

Friday the 4th of December would be an easy day for me. I had to write a management summary for a customer and I would be attending a top-secret meeting in the afternoon (details of which I will not make known here and now). When getting up in the morning it had been snowing and freezing severely, so the traffic situation was worse than ever. I left my home at about half past nine and struggled my way to the office.

Getting there I hooked up Jadzia to the office LAN and started working. One of my customers is selecting a package for Sales Force Automation (SFA) and I am responsible for evaluating and advising on the client architecture of the various packages at hand. Friday was the day we would have to hand in our findings regarding the top two contenders. In my e-mail inbox I found the management summary of one of my collegues on the project. The document was in Microsoft Word 95 format, which is the customer's standard (as you can see, I still have some evangelising to do here :-). I imported it into Applix in order to review it. Applix loaded the file without any problems.

Again using Applix, I wrote down my findings on the SFA packages, resulting in a 2-page document (only a 9 Kb file by the way). Once finished, I wanted to send this document to my collegues at the project. Obviously (unfortunately) they do not "understand" the native Applix Words format. I exported the document to RTF (Rich Text Format, only a 5 Kb file) and attached it the e-mail message in which I announced the availability of my management summary document. Just for fun, I also attached the Applix Words (".aw") file. I was to hear more from this later that day!

Intermezzo

Following this "hard labour" I had a lunch date with Marielle Klatten, the pretty (good) office manager of the Dutch Unix User Group (NLUUG). She is always smiling, good humoured, and generally fun to be with. The NLUUG offices are located inside the UUNET building in Diemen, which is right around the corner from my office. I walked to the parking garage,  jumped in my car and attempted to start it. Unfortunately, for the first time since I owned this car, it failed to start :-(.

Scheisse (bin ich wieder das Englandische Wort fuer "shit" vergessen)!

I concluded that I had most likely run out of gas. My car is dual powered: it contains a tank for regular (unleaded) gas and a pressurised barrel for LPG (a form of liquified gas). LPG is much cheaper and I normally use that tank only. However, the engineers of my LPG installation figured that it would be best to start the car using normal gas, and automatically switch to LPG after a short while. As a consequence, I use a small amount of normal gas each and every day (maybe only 100 ml). That tank was now completely empty! So although I had almost 40 liters of LPG on-board, I could not start.

I jumped out and walked the short distance to the NLUUG office . There I met Marielle and we drove to our local Italian restaurant in her car. Following a pleasant (if somewhat hasty) lunch and a productive meeting, Marielle drove me to the local gas station where I picked up 5 liters of normal gas. We threw some in the tank and the car started like never before!

I write

After all this excitement, there was still some work to do. I live in a brand new neighbourhood, and the owners of the houses here have formed a group in order to combine and enlarge their negotiating powers. I have the distinct honour and privilege to be the chair person of this dissimilar group of people. Over the last year, we have had many problems, one of which is that the builder placed the wrong doors in 69 (of the 99) houses in our neighbourhood. The builder offered either replacement of the door, or financial compensation, for this. We did not think the amount offered to be enough, so after some lenghty negotiations, they increased the offer by more than 30%! I had to write (and fax) a letter confirming our agreement on this. Furthermore, I wanted to write an information bulletin for the members outlining the agreement we had reached.

Writing these in Applix Words turned out to be a breeze (as expected). Printing turned out to be a bit more difficult.

I print

The biggest and best printer we have at the office is a network connected HP Laserjet 4000 (hp4000.osp.nl). It understands both PCL6 and PostScript so it seems a perfect match to Applix Words' printing capabilities (which are PCL5 and PostScript). Hewlett-Packard obviously ships printer drivers for all DOS, Windows and Netware versions in the known universe. Our Windows machines print to the HP4000 either directly across the LAN (using HP's supplied printer driver) or through a Windows NT server that shares a printer spooler queue that is mapped on the network printer.

How should I print to this printer from Jadzia (my laptop)?

Because the HP4000 understands PostScript, I can beam PostScript to it directly, without any need for translation. We used to own a Minolta network laser printer which understood the FTP protocol. You could send it a file through FTP which it would subsequently print. Maybe the HP4000 was this smart as well? I tried to FTP to the printer but I got a "Connection Refused". Obviously our HP4000 does not understand FTP. I then tried to telnet to the printer, which succeeded. I landed in a sort of printer configuration menu in which I could set the printer host name, default gateway and other printer parameters. Unfortunately, the menu did not contain any hints on how to print to it.

To get some information about what the printer did, and did not, understand, I decided to perform a port scan. The "Satan" program (by Dan Farmer and Wietse Venema) contains a program called "tcp_scan" that you can use to scan for TCP ports which accept network connections. I performed a scan on ports 1 to 1000. "tcp_scan" immediately returned that the printer accepted connections on port 23 (telnet) and, ........., 80, the port of the World Wide Web protocol HTTP! I interrupted the port scan and fired up Netscape Navigator to connect to the printer (http://hp4000.osp.nl). I was immediately redirected to a web application running on one of our Windows NT servers. This web application turned out to be a very general network printer (JetDirect) configuration program. Again, no pointers on how to print from UNIX.

Since the HP4000 is shared from our main Windows NT server, I contemplated using "smb_print" for a while. This utility can be used to print data from UNIX (Linux) to a Lan Manager, OS/2 or Windows NT shared printer. My reflections on this were very brief: no way!

I knew that my collegue Wout could print to the HP4000 from the Linux workstation that he uses for software development. He had obviously configured his Linux printing subsystem (printer spooler) to print to the HP4000, so I decided to check his printer configuration. Linux contains a version of the BSD printer spooler system in which users use the "lpr" command to send files to the printer spooler. The printer spooler optionally performs translations (such as ASCII to PostScript) and sends the file to the printing device. The entire subsystem is configured using the configuration file "/etc/printcap". In addition, the command "lpc" is used to control the printer spooler.

Although I had used and configured BSD printer spoolers before, I am not a real BSD printing expert. Now was obviously the time to become one. The "/etc/printcap" contains printer destination configurations. Each destination has a name and a bewildering array of options that can be used to specify things like the destination spool queue directory, the device file of the printer and the translation scripts to run. Wout's "/etc/printcap" entry for the HP4000 looked pretty simple. For one thing it did not contain an "lp" configuration entry (which denotes the device file of a local printer). I found this logical since we should be printing to a network connected printer. It did however contain an "rm" and an "rp" entry. These are used to denote printing to a remote BSD printer spooler. The "rm" entry contained the name of the HP4000 printer, and the "rp" entry contained the name "lp".

This seemed to suggest that the HP4000 understood the BSD remote printing protocol all by itself! This would be good! I looked up the TCP port number used by BSD remote printing in "/etc/services". It turned out to be 513. I then used "tcp_scan" again to do a port scan of TCP ports 500 to 520. "tcp_scan" immediately reported that the printer was willing to answer connections on port 513! Hurrah, one hurdle taken!

I would now have to setup Jadzia's "/etc/printcap" to contain a remote BSD printer on "hp4000.osp.nl". On Wout's machine the printcap entry of the HP4000 also contained an "if" entry which is used to denote a filter script that has to run on the printed data. This "if" entry pointed to a script called "filter". I looked at the script but could not immediately determined what it did. I suspected it to be part of the "apsfilter" package, which can perform all kinds of conversions on data before it is printed. Maybe I would have to setup "apsfilter" as well? As it turned out, I had installed the "aps" package on Jadzia. I reviewed some of the package documentation (in "/usr/doc/packages/aps") and it turned out there was a "SETUP" script to setup printer destinations using "apsfilter". I started the "SETUP" script but found out that it could only setup local parallel or serial printers. (Later I thought up that I could have used this setup script and modified the resulting "/etc/printcap" entries manually).

Hmmm, maybe YaST could help? I started YaST, but was unable to find an option for configuring printers. (I later discovered that there is support for creating printers, but I had overlooked the option. Again, it can only be used to configure local serial or parallel printers. Using this and then manually editing the printcap configuration seems viable to me as well).

I then realised that I probably did not need a filter script. Applix Words generates PostScript and the printer understands PostScript, so I saw no need to process the data before it was sent to the printer. I decided to create a very simple entry in "/etc/printcap":

hp4000_ps:\
        :sd=/var/spool/lpd/hp4000_ps:\
        :mx#0:\
        :sh:\
        :rm=hp4000.osp.nl:\
        :rp=lp:
The printer destination name is "hp4000_ps", it stores its spool files in "/var/spool/lpd/hp4000_ps", it does not have a maximum size for print jobs (the "mx" option), it does not print a burst page header ("sh") and the real printing destination is the BSD remote printer "lp" at host "hp4000.osp.nl". Obviously, the printer spooler directory does not magically appear out of nothing, so I created it manually. After editing the "/etc/printcap" I started the printer spooler subsystem with the command "lpc start all". Ok, all things set up, let's print! I switched back to Applix Words and chose "File->Print". The "hp4000_ps" printer appeared in the list of printers allright. I selected it and pressed "Ok". Nothing happened.

Right. Disappointed!

A messy debugging cycle then started. Did the spool directory exist? Was the "printcap" entry correct? Did the printer daemon run? As it turned out, I had made some syntax errors in the printcap entry (the one showed above is the correct one). After I had corrected these I found out that I had forgotten to change the ownerships of the spooler directories to "lp". Once that was all corrected I manually cleaned the spooler directories, stopped the "lpd" daemon, removed the lock files and restarted the "lpd" daemon ("lpc restart hp4000_ps"). I printed the document again (from Applix Words), and voila, before I could see what had happened, the document rolled out the printer. Success at last!

I write and print some more

Encouraged by this success, I fired up Applix Words again to write the information bulletin. The next challenge would be to create this and print 80 copies of it. To liven up the information bulletin I would like to include some clip art in it. From the Applix clip art I selected a nice one showing a nice group of houses in a foresty environment. I included it in the document. Unfortunately, the clip art was *very* big, bigger than my page. I messed about a bit trying to resize the object., in which I unfortunately did not succeed. I must say that I am fairly confident that it is possible to do it in Applix, I just do not know how. So I tried another approach.

Using ApplixI am a registered member of ArtToday (http://www.arttoday.com), one of the biggest collections of clip art, web art and digital photos on the Internet. I decided to browse through their database to look for a picture the correct size. This was easily found and I downloaded it into my "/home/josv/tmp" directory. From there I included it in my document. Applix Words has a handy "frame" feature that can be used to divide your page in separate independently positioned frames so that text and pictures do not interfere with one another. Once I finished the information bulletin, I hit the "File->Print" option again and requested that Applix print 80 copies of the document. To my surpise, Applix gave an error message saying that it could only print from 1 to 20 copies! Why this silly maximum? Why not 6, 99 or 64? Obviously, there are no prizes for the workaround, I hit "File->Print" 4 times, printing 20 copies at a time.

I print from Netscape Navigator

The Navigator print dialogWhile waiting for the 80 information bulletins to roll out of the printer, I remembered that I had promised my daughter Merel to make some print outs of a bunch of Teletubbie pictures from the BBC Teletubbies web site. These are black and white pictures that can be coloured in by the children themselves. I surfed to the site and requested the pages that contain these pictures. To print these I would have to use Netscape Navigator's "File->Print" menu option. I never judged Navigator's printing capabilities to be very good, but under UNIX they are even more limited. It supports only PostScript and a quite limited set of print options (such as the page size and page orientation). Furthermore, you have to specify the exact "lpr" command that Navigator is to issue in order to print the PostScript file that it generates. The advantage of this is that you have complete control over the printing process, and that the Netscape engineers do not have to waste valuable neurons and synapses to cough up the optimal print command for each platform that they port Navigator to. The disdvantage is that the individual user has to think very hard before he has created the correct "lpr" minus so-and-so for his specific environment. In my case, I wanted to print each page three times, which I tried by using "lpr -Php4000_ps -#3". However, each page was only printed once. I suspect that the handling of the "-#" option is left to one smart printing filter or another. I really need to investigate "apsfilter" sometime. I did not feel like putting in any more time in this problem right now, so I just hit "ALT+P ENTER" a couple of times per page to achieve the desired effect.

The SFA management evaluation revisited....

During all this commotion, I checked my e-mail and found a reply from a co-worker who is also working on the SFA selection project I mentioned earlier. He complained that I had sent him my management summary in two formats that he could not read in Microsoft Word: RTF and "some obscure format called .aw". Obviously, Microsoft's stronghold on the market is such that some people are now conceptually unable to imagine that there are wordprocessor document formats other than Microsoft Word. How sad :-(. I replied with instructions how he should import the RTF file in Word, and threw in an HTML and a PostScript version of the document as well (Applix can export to HTML and you can print PostScript to a file).

EOD

It was half past six, time to go home.


Last change: 6th December 1998 (the morning after Sinterklaas) by me