L120: Linux System Administration II



Yüklə 1,05 Mb.
səhifə12/16
tarix11.10.2017
ölçüsü1,05 Mb.
#4275
1   ...   8   9   10   11   12   13   14   15   16

Printing


Prerequisite


  • None


Goals


  • Understand the GNU printing tools used to submit and administrate print jobs

  • Configure a LPRng print spooler


1. Filters and gs

For non-text formats Linux and UNIX systems generally use filters. These filters translate JPEG or troff file formats into a postscript type format. This could directly be sent to a postscript printer, but since not all

generic printers can handle postscript, an intermediate 'virtual postscript printer' is used called ghostscript or gs which translates the postscript into printer compatible language (PCL) or something that the printer understands.

The commercial version of ghostscript is Aladdin Ghostscript and the GNU version is derived from this.


The gs utility has a database of printer drivers it can handle (this list is usually up to date, for example many USB printers are supported) and converts the postscript directly into PCL for these known models. The gs utility plays a central role in Linux printing.

2. Printers and print queues

As seen above simple ascii text printing is not handled in the same way as image or postscript files. If you only have one printer and you would like to printout your mail for example, it may not be necessary to use a filter. You may want to define a queue without filters, which would print mail faster. You could also define a queue on the same printer, which would only handle postscript files.


All queues and printers are defined in /etc/printcap. Here is the full configuration of a remote printer 192.168.1.20 using the remote queue named ‘lp’:

lp:\


:sd=/var/spool/lpd/lp:\

:mx#0:\


:sh:\

:rm=192.168.1.20:\

:rp=lp:

The essential options here are rm the remote host, sd the spool directory and rp the name of the remote queue. Notice that no filters are specified (you would use if for input filter). All the filtering is done on the remote host.



3. Printing Tools



lpr:
The lpr utility is used to submit jobs to a printer. This is a modern version of lp (line print). From a user’s point of view it is helpful to understand that a printer can be associated with more than one queue. Here are two examples to print a file called LETTER.
Send job to default printer:

lpr LETTER


Send job to the’ ljet’ queue:

lpr -Pljet LETTER



Table1: Main Options for lpr


-#num

Print num copies

-Ppq

Specify the print queue pq

-s

Make a symbolic link in the spool directory rather than copy the file in

lpq:


A user can monitor the status of print queues with the lpq utility. Here are a few examples.
Show jobs in default queue:

lpq
Show jobs for all queues on the system:

lpq -a
Show jobs in the ‘remote’ queue:

lpq -Premote



lprm:
Depending on the options in /etc/lpd.perms users may be allowed to delete queued jobs using lprm.
Remove last job submitted:

lprm
Remove jobs submitted by user dhill:

lprm dhill
Remove all submitted jobs:

lprm -a (or simply lprm -)


It is possible to remove a specific spooled job by referencing the job number; this number is given by lpq.

lpc:
The Line Printer Control utility is used to control the print queues and the printers. The print queues can be disabled or enabled. Notice that lprm on the other hand can remove jobs from the queue but doesn’t stop the queue.
One can either use lpc interactively (lpc has its own prompt), or on the command line.
Here is an output of lpc –help:
CMD: /usr/sbin/lpc help

► Commands may be abbreviated. Commands are:


abort enable disable help restart status topq ?

clean exit down quit start stop up


The enable/disable/topq/up/down options relate to queues

The start/stop options relate to printers


mpage:
This tool will format a document to print a fixed number of pages per sheet. The default is four pages per sheet. This is usefull to have a quick overview of a document.


4. CUPS

CUPS (an acronym for Common Unix Printing System) is a modular printing system for Unix-like computer operating systems which allows a computer to act as a print server. A computer running CUPS is a host that can accept print jobs from client computers, process them, and send them to the appropriate printer.


CUPS consists of a print spooler and scheduler, a filter system that converts the print data to a format that the printer will understand, and a backend system that sends this data to the print device. CUPS uses the Internet Printing Protocol (IPP) as the basis for managing print jobs and queues. It also provides the traditional command line interfaces for the System V and Berkeley print systems, and provides support for the Berkeley print system's Line Printer Daemon protocol and limited support for the server message block (SMB) protocol. System administrators can configure the device drivers which CUPS supplies by editing text files in Adobe's PostScript Printer Description (PPD) format. There are a number of user interfaces for different platforms that can configure CUPS, and it has a built-in web-based interface. CUPS is free software, provided under the GNU General Public License and GNU Lesser General Public License, Version 2.

Overview

CUPS provides a mechanism that allows print jobs to be sent to printers in a standard fashion. The print-data goes to a scheduler which sends jobs to a filter systemthat converts the print job into a format the printer will understand.The filter system then passes the data on to a backend—a special filter that sends print data to a device or network connection. The system makes extensive use of PostScript and rasterization of data to convert the data into a format suitable for the destination printer.

CUPS offers a standard and modularised printing system that can process numerous data formats on the print server. Before CUPS, it was difficult to find a standard printer management system that would accommodate the very wide variety of printers on the market using their own printer languages and formats. For instance, the System V and Berkeley printing systems were largely incompatible with each other, and they required complicated scripts and workarounds to convert the program's data format to a printable format. They often could not detect the file format that was being sent to the printer and thus could not automatically and correctly convert the data stream. Additionally, data conversion was performed on individual workstations rather than a central server.

CUPS allows printer manufacturers and printer-driver developers to more easily create drivers that work natively on the print server. Processing occurs on the server, allowing for easier network-based printing than with other Unix printing systems. With Samba installed, users can address printers on remote Windows computers, and generic PostScript drivers can be used for printing across the network.



CUPS web-based administration interface

On all platforms, CUPS has a web-based administration interface that runs on port 631. It particularly helps organisations that need to monitor print jobs and add print queues and printers remotely.

CUPS 1.0 provided a simple class, job, and printer-monitoring interface for web browsers.

CUPS 1.1 replaced this interface with an enhanced administration interface that allows users to add, modify, delete, configure, and control classes, jobs, and printers.

CUPS 1.2 and later provide a revamped web interface which features improved readability and design, support for automatically discovered printers, and a better access to system logs and advanced settings.
CUPS web interface screenshot:



5. Exercises and Summary


Term

Definitiion

Filter

Scripts used to prepare a document before printing

Device

Type of connection used to access the printer (e.g parallel, USB or network)

Driver

Translates raw or postscript type formats into printer specific instructions such a s PCL


Files


File

Description

/etc/printcap

Read by the lpd daemon at start up and contains a list of configured printers


Commands


Command

Description

lpc

line printer control program

lpd

line printer daemon

lpq

print printer queue status

lpr

submit files for printing

lprm

remove a queued print job

mpage

print multiple pages of a document on one page



Yüklə 1,05 Mb.

Dostları ilə paylaş:
1   ...   8   9   10   11   12   13   14   15   16




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©www.genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə