Power Printing With MagicFilter
Now it's time for some tests. First, try printing a normal text file from your prompt; something short, like:
Your printer should print the file without the staircase effect. Assuming no problems here, try printing a PostScript (.ps) file. Next, try a graphics file like a .gif or .jpeg. If you have one handy, try printing a .dvi file. All these files should produce perfect output. Finally, try printing a binary file like /bin/sync. You should not get any output from your printer, and, if you're running sendmail, smail or other mail agent, you should get an almost immediate e-mail from firstname.lastname@example.org explaining why your file could not be printed. If you're not running a mailer, your $ prompt will return, and you will get no output from your printer. MagicFilter does not display error messages on the console.
At this point, it's worthwhile to print a listing of the actual filter scripts for your printer. You'll notice that it's an interpreted script with MagicFilter as the interpreter. It's laid out in three vertical columns. Column one is the offset from the file's beginning, column two is the string of characters searched for and column three is the facility for dealing with each type of file. Reading down the column, you can see all the different types of files that MagicFilter can handle and how it handles them, as well as the ones it can't. Note the pipe and fpipe methods in column three. That method's output is fed back into MagicFilter for a second or subsequent pass. This is necessary in the case of .dvi files, for example. First dvips runs on the .dvi file, and the resulting temporary PostScript file is fed back into MagicFilter where ghostscript then performs the actual printing—pretty slick.
This popular e-mailer requires a little tweaking to work properly. If you leave Pine's default printing mechanism set to lpr, you may find that e-mails of more than one page will lose the last 2 or 3 lines of text on some printers. This is due to the fact that some printers, Canon ink jets for one, can't print more than 63 lines per page, and lpr thinks they ought to have 66 lines per page. To fix this, create a short script called print, containing these two lines:
#!/bin/sh pr $1 | lpr
Put this script in your home directory, or somewhere in your path, then install it as Pine's printing command. From Pine's main menu, select as follows: S (setup), P (printers), then arrow down to “Personally selected print command”. Set “Printer List” to /dev/lp1 (or whatever your printer device is named) and your print command (on that same line) to ~/print. To make these changes, enter C-N (change, name) and then C again (change command). Save your changes when prompted.
This printing setup will run your e-mail through the pr utility for formatting before spooling to print. This is kind of neat, because your pages of output will have a date/time stamp and page number on the top of each page. You can modify pr's behavior with command line switches to produce the appearance you wish (see man(1) pr).
You should be able to print from Netscape without any tweaks at all. To test it, fire up Netscape and load a challenging document. From the File menu, select Print and observe the dialog that opens up. From the top of the dialog, verify that the “Printer” button is pushed, that your “Print Command” is lpr and that the rest of the print settings make sense for your printer and paper. Then, press the “Print” button. Figure 1 shows how this should look.
You should get a printout of exactly what's on your browser screen, graphics and all. Of course, this assumes you have a graphics-capable printer and that you built MagicFilter with at least ghostscript support. Netscape defaults are stored in a file called ~/.Netscape/preferences. You can check that file to make sure your print command is lpr and adjust it, if necessary.
You can even use Netscape as a sort of kludgy word processor. From the File Menu, select “New Document -> Blank”. The Netscape Editor will open up with a blank screen, ready to copy. This editor is geared toward HTML; it's great for writing WWW pages, but for producing letters, etc., it leaves a lot to be desired. With Netscape's editor, what you see on the screen usually does not exactly match the printer output.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Sony Settles in Linux Battle
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Libarchive Security Flaw Discovered
- Profiles and RC Files
- Maru OS Brings Debian to Your Phone
- Understanding Ceph and Its Place in the Market
- Snappy Moves to New Platforms
- The Giant Zero, Part 0.x
- Git 2.9 Released
- Astronomy for KDE
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide