Filters

Filters are where most of the actual work is done in printing. When lpd sends data to a filter it sets the filter's STDIN to the file that is to be printed and its STDOUT to the printer device.

Text Filters

As its name implies, the text filter is the filter that lpd uses when it receives plain text to print. The text filter can be as simple as a shell script that uses cat to simply pass the raw data to the printer, or as complex as a program that changes the data into a completely different format. An example of a complex filter is one that uses GhostScript, which takes raw PostScript data and changes it into a format that a non-PostScript printer can understand.

A very simple text filter for lpd would look like this:

 #!/bin/sh /bin/cat ...

Get FreeBSD® Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.