16 September 2000 Robert Basler is the president of Aurora Systems, Inc. If you have a comment about the content of this article, please feel free to vent in the OS/2 eZine discussion forums. |  |
Previous Article | Home | Next Article
## Printing on an OS/2 Printer with an Apple iBook This is the first OS/2 eZine article I've written using my new Apple iBook. Although I bought the iBook mainly to develop and test some cross-platform software I'm working on, the more I use it, the better I like it. The six hour battery life is especially nice. While the iBook comes with lots of great bundled software, it is definitely lacking in one area, built-in PC connectivity. I had originally planned to use both server hard disk space and my existing printer rather than purchasing extra Apple hardware. Imagine my surprise when I discovered the iBook doesn't do NetBIOS and OS/2 doesn't talk Appletalk. Fortunately, I have discovered that it is possible to print to a printer attached to an OS/2 server, all you need is LPD, Ghostscript, and a handy little utility called printmon by Kai Uwe Rommel. Software You'll Need The first program you'll need is printmon.zip, available on Hobbes at ftp://hobbes.nmsu.edu/pub/os2/util/printer/printmon.zip . This little utility allows you to redirect data sent to a printer port to somewhere else. If you don't have the latest version of the EMX Runtime Library, you'll need to obtain emxrt.zip from Hobbes. You'll also need Ghostscript. This is a remarkable package at a spectacular price. It is a complete postscript interpreter capable of reading postscript and PDF files and printing them to a wide variety of non-postscript printers, or for viewing the files onscreen. You can download the latest 6.01 version from http://www.cs.wisc.edu/~ghost/aladdin/ Lastly, you'll need a .CMD file to run everything, modified with your configuration of course. This is the one I use: c: cd \gs6.01\bin set gs_lib=c:\gs6.01\fonts;c:\gs6.01\lib;c:\psfonts set gs_load=10 \apps\printmon lpt2 "gsos2 -sDEVICE=bjc600 -sOUTPUTFILE=lpt1 -q -dBATCH -" Setting up your OS/2 Server The first thing to do is to set up the Line Printer Daemon (LPD) on your OS/2 server. LPD is the TCP/IP line printer daemon which provides a service that allows any workstation that can reach it via TCP/IP to print on its attached printers. Note that LPD is a TCP/IP <B>SERVICE</B>, so if your server is connected to the internet via a permanent connection, you should configure your firewall to prevent anyone outside your lan from abusing your print facilities. To set up LPD to start automatically each time your server starts, go to the OS/2 System Setup and choose TCP/IP Configuration. Go to the Autostart tab and click on LPD. I personally prefer to run it as a detached session so that it doesn't show up in the task list, but you can run it however you prefer. There are optional switches you might find useful, see the TCP/IP Command Reference for more information. Restart your OS/2 server then create a new printer object. Select a postscript printer driver for the new printer object. I called my printer "Ghostscript" and used the Apple Laserwriter II NTX driver. Set it to output to a non-existent LPT port, I selected LPT2 -- this is the port that you will have printmon intercept later. While you're there, have a look at the View tab and write down the physical name of the printer, you'll need that when you set up your iBook to print. Installing Ghostscript is a matter of unzipping the GS601OS2.ZIP file, making sure to recreate the internal directory structure. It will create two directories, one for Ghostscript and one for fonts. Then you need to modify the GS.CMD file with your paths. The SET GS_LIB= line above tells Ghostscript where to find fonts, setup files, and the OS/2 Adobe fonts respectively. I'm not sure the SET GS_LOAD= line does anything in this case, but it can't hurt anything and it is supposed to keep Ghostscript in memory to reduce load times when you are printing multiple print jobs. Figuring out the command line you need for printmon is also pretty straightforward. Its parameters are the port to intercept, and the command to pipe the intercepted data to surrounded by double quotes. The command line for GSOS2.EXE is a little more involved so I'll go through each of the options I'm using: gsos2 -sDEVICE=bjc600 -sOUTPUTFILE=lpt1 -q -dBATCH - The -sDEVICE=bjc600 option specifies the driver that will be used to print to the printer attached to your OS/2 server, I have a Canon Bubblejet BJC-600. If you want to see a list of the available drivers and all the switches, run GSOS2 with the -h help switch or see the Ghostscript documentation. The -sOUTPUTFILE=lpt1 should be set to the name of the port that the server's printer prints to. -q silences a lot of messages. -dBATCH makes sure that even if Ghostscript has an error while printing, it exits cleanly to allow everything to keep working. The last - tells Ghostscript to accept input from stdin and is needed when the data is routed to it by printmon. For testing, I ran the GS.CMD file from an OS/2 command prompt so I could see the messages it produced. Once you have everything working and reliable, you can add the line DETACH C:\GS6.01\GS.CMD to your STARTUP.CMD file so that it starts automatically each time your server starts. Setting up the iBook All you need to do on the iBook is create a new LPR printer using the Desktop Printer Utility. If you can't find it on your iBook, you can start it from the help if you look in the printer section. In New Desktop Printer, select Printer (LPR) and click on OK. For Postscript Printer Description (PPD) File, Generic works well. For LPR Printer Selection, click on Change, then enter the IP address of your OS/2 print server and enter the physical name of the server printer you noted before into the Queue entry, for me this was GHOSTSCR. You can click on the Verify button to confirm that the connection is working. Click on OK, and lastly click on Create and name your printer. In a moment it will appear on your Mac's desktop. Testing Everything If all has gone well, you should now be able to print from any Macintosh application to the printer you have created. You will see the print job travel over the lan, appear in the Ghostscript printer queue, go through Ghostscript in your OS/2 command window, move to your real printer's queue, and finally out of the printer. If you have a color printer, it will even print color correctly. I have to admit, the first time I saw it work, I just about fell over with surprise. It all seems a little too complicated doesn't it? Postscript Printing from OS/2 One nice side benefit of all this is that now I can use the Ghostscript printer driver for printing from my OS/2 workstations. This is nice because the Omni Bubblejet driver sets the printer to its highest quality mode with no option to set to regular quality for faster printing and less ink use. The Ghostscript driver allows you to adjust many printing settings manually including the print quality. Wrap Up I have really come to enjoy my iBook. It is reliable, the software is slick, and it has the great feature that attractive women seem to want to talk to me about it whenever I'm out in public with it (this is obviously not my wife's favourite feature.) The iBook has already reduced my use of my Thinkpad to email and a few other indispensible OS/2 applications. If you have the opportunity, I recommend you give one a spin. A Request for Help If you have had success finding an affordable option for getting OS/2 to share files with a Macintosh, or happen to have a copy of Lan Server for the Macintosh you want to give away, I'd be very interested in hearing from you. At this point I'm using FTP for file sharing which isn't a great solution.
Previous Article | Home | Next Article