Upload
m3onh0x84
View
237
Download
0
Embed Size (px)
Citation preview
8/9/2019 Ch06 Printing
1/25
8/9/2019 Ch06 Printing
2/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Objectives
Explain the print spooler model
Demonstrate how to add one or more printers
Configure network printers
Identify and install print filters
Demonstrate how to use PostScript printers
8/9/2019 Ch06 Printing
3/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Print SpoolerModel
A user submits a print job with the lpr command
The system puts the job into the proper queue in the
/var/spool/lpd directory
The printer daemon prints jobs from the spoolerqueue (s)
8/9/2019 Ch06 Printing
4/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
UserCommands
Submit print jobs with (BSD) lpr:
Each job has a unique request id, displayed on the
screen
System should have a default printer, override withP
Users can specify default with PRINTER variable
$ lpr -P clerk /etc/hostsprint with clerk printer
$ lpr /etc/hosts print with default printer
8/9/2019 Ch06 Printing
5/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
UserCommands
List job (in queue) details with lpq:
$ lpq -P clerk
$ lpq
$man lpq Delete jobs with lprm:
$lprm job-id
$ cancel job-id
8/9/2019 Ch06 Printing
6/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
mpage
mpage is a utility that allows you to print multiple
text and PostScript documents onto one page
mpage file
Example:$mpage -4 test_file.txt| lpr
8/9/2019 Ch06 Printing
7/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Manipulating Printers with LPC
All printer control done with lpc:
Enable or disable printer
Enable or disable a printers queue
Rearrange the order of jobs in a queue
Find the status of printers, queues, daemons
Syntax :
lpc [command [all | printer]]
8/9/2019 Ch06 Printing
8/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Manipulating Printers
abort This command works like stop butterminates printing immediately, evenin the middle ofa job. The job isretained for reprint when the printer isagain started
disable enable
These two commands control the queuingof new print jobs. With a queuedisabled but printing started, printingcontinues but new jobs are rejected
start stop
These two commands control printing andthe child lpdprocesses. When a stopcommand is issued, the current printjob is allowed to complete. Then thechild daemon is stopped and furtherprinting is disabled. start enablesprinting and starts the child lpd if jobsare pending. The print queues remainactive
8/9/2019 Ch06 Printing
9/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Manipulating Printers
down [message] disable, stop, and store the free-formmessage for display by lpr, informingthe user why the printer isunavailable
up en
able
and st
art
restart This command kills and restarts a childlpd, or starts one when none waspreviously running
exit or quit Terminate lpc'sinteractivemode
help Display help information on commands
8/9/2019 Ch06 Printing
10/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Adding a Printer
All printer configurations are defined in /etc/printcap
Adding a printer is very straightforward with the easy
to use tools that are available with most distributions
printtool. Without printtool, you must manual editing
configuration file (/etc/printcap)
8/9/2019 Ch06 Printing
11/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Adding a Printer
Verify /etc/printcap file and /var/spool/lpd/ directory
to ensure the success of printer creation
Printtool can be used to setup many different kinds of
printers.Local printer
Network printer
8/9/2019 Ch06 Printing
12/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Printing Environment
8/9/2019 Ch06 Printing
13/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Adding new network printer
8/9/2019 Ch06 Printing
14/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Adding new network printer
8/9/2019 Ch06 Printing
15/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Adding new network printerA
8/9/2019 Ch06 Printing
16/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
8/9/2019 Ch06 Printing
17/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Adding new network printer
8/9/2019 Ch06 Printing
18/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Tips
cat /etc/printcap
rm /etc/printcap
/etc/init.d/lpd stop
/etc/init.d/lpd start
cat /etc/printcap and compare with the original
8/9/2019 Ch06 Printing
19/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Network Printing Configuration
On printer server :
Edit /etc/hosts.lpd or /etc/hosts.equiv to include
names of remote machines that you want to allow
to print to your printer On printer client :
Edit /etc/printcap
8/9/2019 Ch06 Printing
20/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Sample of /etc/printcap
#Local printer
#
lp|ljet:\
:sd=/var/spool/lpd/lp:\
:mx#0:\:sh:\:lp=/dev/lp0:\
:if=/var/spool/lpd/lp/filter:\
:lf=/var/spool/lpd/lp/log:
8/9/2019 Ch06 Printing
21/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Sample of /etc/printcap (cont.1)
# Remote printer
# lp| dj| deskjet:\
:sd=/var/spool/lpd/dj:\
:rm=machine.out.there.com:\
:rp=printername: \
:lp=/dev/null: \:sh:
8/9/2019 Ch06 Printing
22/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Sample of /etc/printcap (cont.2)
# Remote SAMBA printer
#
lp| remote-smbprinter:\
:lp=/dev/null:\
:sh:\
:sd=/var/spool/lpd/lp-samba:\
:if=/usr/local/sbin/smbprint:
8/9/2019 Ch06 Printing
23/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Tips forCups
/etc/cups/printers.conf
Info printer
DeviceURI smb://192.168.22.90/HPLaserJ.
State StoppedStateMessage
Accepting No
JobSheets none none
QuotaPeriod0
PageLimit 0
KLimit 0
/etc/init.d/cups [stop|start|restart]
8/9/2019 Ch06 Printing
24/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Command PrinterManagement
$lpadmin [option]
$lpstat t
$enable printer_name
$accept printer_name
$lpr
$lprm and cancel
8/9/2019 Ch06 Printing
25/25
SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102
Summary
Explain the print spooler model
Demonstrate how to add one or more printers
Configurenetwork printers
Identify and install print filters
Demonstrate how to use PostScript printers