FreeBSD 6 Unleashed

A number of things can go wrong when you use printers. This section discusses some of the most common problems and their solutions.

Printer Does Not Receive Data; Jobs Are Sitting in Queue

Check lpq and make sure that the spooling daemon is running. If it says Warning: no daemon present, you will need to use lpc to restart the spooling daemon. Also check lpc and make sure that the printer is not disabled.

Further culprits can include a printer that's become locked up and needs to be power-cycled.

One method for narrowing down the possible causes of data that doesn't get printed is to redirect the output of CUPS to a local file, print the job, and check the file to make sure it received the data. If it didn't, the printing subsystem itself isn't sending the data. If it did, the printer is to blame.

Data Light on Printer Flashes, but Printer Will Not Print

This is often a symptom of sending non-PostScript data to a PostScript printer. Check your filter and make sure it is filtering text correctly and converting that text to PostScript.

Printing an Image File in GIMP or a Web Page Results in Hundreds of Pages of Garbage Being Printed

This can often be a symptom of feeding PostScript data to a printer that doesn't understand PostScript. The non-PostScript printer will try to print this file as plain text. Check out the GhostScript program and also see the section earlier in this chapter titled "Printing PostScript Files on Non-PostScript Printers."

Printers with a lot of onboard memory can exhibit the maddening tendency to keep printing the garbage PostScript data even after you've canceled the print job. You'll need to cancel the job and power-cycle the printer to make sure the spooled pages are flushed from the printer's memory and it stops wasting your paper.

The Printer Is Slow

Try setting the printer to polled mode (assuming this printer is on the parallel port). Use the following command:

# lptcontrol -p

Remember that you will need to add this command to a startup file if you want it to take effect at each system boot. See the section at the beginning of the chapter on lptcontrol.

Printed Output "Stair Steps"

The symptoms of the stair-step problem look something like this:

Line one of the file. Line two of the file. Line three of the file. Line four of the

This pattern will continue until the text runs off the end of the page. This is a fairly common problem caused by differences in the way UNIX and DOS/Windows interpret the line-feed (LF) character. When DOS/Windows advances to a new line, it sends both a carriage-return (CR) and a line-feed. UNIX, on the other hand, sends only a line-feed character and expects a carriage-return to be implied. If your printer is expecting DOS-style carriage-return and line-feed combinations but is only receiving a line-feed, it will advance the paper but never return the print head to the beginning of the line. There are a few ways you might be able to solve this problem.

The first is to look for an option in your printer's configuration that changes the way it interprets a linefeed character. See your printer documentation to see whether there is a way you can do this.

The second way is to create a filter that converts the LF to a combination of CR and LF. If your printer understands HP's PCL language, the filter shown in Listing 17.4 is recommended by the FreeBSD Handbook for performing this task.

Listing 17.4. A PCL-based Filter That Converts UNIX-style Line-Feed Characters to a DOS-style Carriage-Return/Line-Feed Combination

#!/bin/sh # # hpif - Simple text input filter for lpd for HP-PCL based printers # Installed in /usr/local/libexec/hpif # # Simply copies stdin to stdout. Ignores all filter arguments. # Tells printer to treat LF as CR+LF. Ejects the page when done. printf "\033&k2G" && cat && printf "\033&l0H" && exit 0 exit 2

See the section on text filters earlier in this chapter for more information on how to install and use this filter.

If your printer does not understand PCL, you might be able to use the tr command to convert the LF into a CR+LF. A filter such as the one in Listing 17.5 may do the trick.

Listing 17.5. A NonPCL-based Filter That Converts UNIX-style Line-Feed Characters to a DOS-style Carriage-Return/Line-Feed Combination

#!/bin/sh # Filter that fixes the stair-stepping effect on non-PCL printers. /bin/cat | tr '\13' '\13\10' && exit 0 exit 2

Once again, see the section on text filters earlier in this chapter for more information on how to install and use this filter.

All the Text Prints on One Line, Creating a Mess and Writing over the Top of Existing Text

This is essentially the opposite of the stair-stepping problem. This problem is rare, but it does happen occasionally. What's happening is that the LF is being interpreted as a CR by the printer. At the end of each line, the print head returns to the beginning of the line and continues printing, but the paper is not being advanced.

To fix this problem, you will need to make changes to your printer's configuration settings so that it interprets CR and LF characters properly. See your printer's documentation for details on how to do this.

If you find that you cannot change the hardware settings of your printer to fix this problem, you can use a filter similar to the one that fixes the stair-stepping problem; you'll just need to modify it so that CR characters (\10) are translated to CR+LF sequences (\13\10).

Категории