UNIXPrinting: Difference between revisions

From UMIACS
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
=Introduction=
==Introduction==


UMIACS uses the LPRng spooling system to provide both a Berkeley UNIX interface to our network printing system.
UMIACS uses the LPRng spooling system to provide both a Berkeley UNIX interface to our network printing system.
Line 8: Line 8:
Basic Commands
Basic Commands


=lpr=
==lpr==


Use `lpr -Pprintername filename.ps` to submit the postscript file named filename.ps to the printer queue named printername. If no filename is specified, lpr reads from standard input. If no printer name is specified, then the job is discarded by the print server.
Use `lpr -Pprintername filename.ps` to submit the postscript file named filename.ps to the printer queue named printername. If no filename is specified, lpr reads from standard input. If no printer name is specified, then the job is discarded by the print server.
Line 14: Line 14:
Additional options to specify media handling, page orientation, and double sided printing can be passed to the print spooler using one or more -Z options. Double sided printing is specified with -Zduplex. Page orientation is controlled with -Zportrait, -Zlandscape. Manual feed media (eg. transparencies) is specified with -Zmanual. Please note that not all printers support all -Z options.
Additional options to specify media handling, page orientation, and double sided printing can be passed to the print spooler using one or more -Z options. Double sided printing is specified with -Zduplex. Page orientation is controlled with -Zportrait, -Zlandscape. Manual feed media (eg. transparencies) is specified with -Zmanual. Please note that not all printers support all -Z options.


=lp=
==lp==


=nscript=
==nscript==


Use `nscript -Pprintername filename.txt` to send the text file named filename.txt to the printer named printername. If no filename is specified, then nscript reads from standard input.
Use `nscript -Pprintername filename.txt` to send the text file named filename.txt to the printer named printername. If no filename is specified, then nscript reads from standard input.
Line 22: Line 22:
Nscript is a weak attempt to simulate Adobe Systems Incorporated nscript programs. It supports a handful of interesting arguments. With the '-G' argument, nscript generates gaudy output that includes header information on each page. The '-2' argument generates two column output and '-r' rotates the job's orientation to landscape mode.
Nscript is a weak attempt to simulate Adobe Systems Incorporated nscript programs. It supports a handful of interesting arguments. With the '-G' argument, nscript generates gaudy output that includes header information on each page. The '-2' argument generates two column output and '-r' rotates the job's orientation to landscape mode.


=enscript-
==enscript==


GNU enscript is coming soon!
GNU enscript is coming soon!


=lprm=
==lprm==


Use `lprm -Pprintername` to remove the first removable job from the print queue printername. You can remove a specific job from the queue by specifying its id as an argument and you can remove all removable jobs from a queue with the argument all.
Use `lprm -Pprintername` to remove the first removable job from the print queue printername. You can remove a specific job from the queue by specifying its id as an argument and you can remove all removable jobs from a queue with the argument all.
Line 33: Line 33:
Use 'lpq -Pprintername' to get the status of the queue named printername. With no further arguments, it will print the printer queue, the host queried, and the number of jobs in the queue. With the -l argument, it will specify the id, queue rank, the total size of the job in bytes, and any errors encountered in processing the job.
Use 'lpq -Pprintername' to get the status of the queue named printername. With no further arguments, it will print the printer queue, the host queried, and the number of jobs in the queue. With the -l argument, it will specify the id, queue rank, the total size of the job in bytes, and any errors encountered in processing the job.


=lprm=
==lprm==


Use 'lprm -Pprintername' to remove jobs from the queue named printername. With no further arguments, it removes the first removable job in the queue. Given a job's id as an argument, it will remove the specified job from the queue.
Use 'lprm -Pprintername' to remove jobs from the queue named printername. With no further arguments, it removes the first removable job in the queue. Given a job's id as an argument, it will remove the specified job from the queue.
Line 40: Line 40:
Basic Tasks
Basic Tasks


=Generate Postscript=
==Generate Postscript==


Postscript is a Page Description Language that is understood by high quality printers and typically generated by applications. There is a lot of documentation about using and programming in postscript, but for our purposes you'll just need to generate postscript from an existing text file.
Postscript is a Page Description Language that is understood by high quality printers and typically generated by applications. There is a lot of documentation about using and programming in postscript, but for our purposes you'll just need to generate postscript from an existing text file.
Line 46: Line 46:
You can generate postscript from an existing text file with textps. For example, to convert the Message of the Day file to a postscript file try `textps ... > file.ps`.
You can generate postscript from an existing text file with textps. For example, to convert the Message of the Day file to a postscript file try `textps ... > file.ps`.


=Preview your job=
==Preview your job==


It's helpful to preview your postscript files before printing by calling Ghostview with `ghostview file.ps`.
It's helpful to preview your postscript files before printing by calling Ghostview with `ghostview file.ps`.
Line 54: Line 54:
Both commands should open a window that displays the contents of your postscript file.
Both commands should open a window that displays the contents of your postscript file.


=Choose a print queue=
==Choose a print queue==


All supported printers are listed at https://booboo.umiacs.umd.edu/printers.
All supported printers are listed at https://booboo.umiacs.umd.edu/printers.
Line 60: Line 60:
You can check list all the print queues with `lpq -a` and you can list just a single queue (eg. ps2109) with `lpq -Pps2109`.
You can check list all the print queues with `lpq -a` and you can list just a single queue (eg. ps2109) with `lpq -Pps2109`.


=Send a print job=
==Send a print job==


After you choose a suitable printer (eg. ps2109), you can send your postscript file to the printer with `lpr -Pps2109 file.ps`.
After you choose a suitable printer (eg. ps2109), you can send your postscript file to the printer with `lpr -Pps2109 file.ps`.


=Monitor a print job=
==Monitor a print job==


You can monitor the job you sent to the printer (eg. ps2109) with `lpq -Pps2109`.
You can monitor the job you sent to the printer (eg. ps2109) with `lpq -Pps2109`.
Line 82: Line 82:
  Waiting connection from 128.8.120.247
  Waiting connection from 128.8.120.247


=Remove a Print Job=
==Remove a Print Job==


If you would like to remove your job from the queue, you should get the job's id from the output of `lpq`. You can remove it with `lprm -Pps2109 198`
If you would like to remove your job from the queue, you should get the job's id from the output of `lpq`. You can remove it with `lprm -Pps2109 198`

Revision as of 17:16, 26 February 2007

Introduction

UMIACS uses the LPRng spooling system to provide both a Berkeley UNIX interface to our network printing system.

The commands are located in /usr/local/bin. They include the programs 'lpr', 'lprm', 'lpq', and 'lpstat'.

All of the UNIX queues are configured to handle postscript. See the examples section for more information on how to print different file types. Basic Commands

lpr

Use `lpr -Pprintername filename.ps` to submit the postscript file named filename.ps to the printer queue named printername. If no filename is specified, lpr reads from standard input. If no printer name is specified, then the job is discarded by the print server.

Additional options to specify media handling, page orientation, and double sided printing can be passed to the print spooler using one or more -Z options. Double sided printing is specified with -Zduplex. Page orientation is controlled with -Zportrait, -Zlandscape. Manual feed media (eg. transparencies) is specified with -Zmanual. Please note that not all printers support all -Z options.

lp

nscript

Use `nscript -Pprintername filename.txt` to send the text file named filename.txt to the printer named printername. If no filename is specified, then nscript reads from standard input.

Nscript is a weak attempt to simulate Adobe Systems Incorporated nscript programs. It supports a handful of interesting arguments. With the '-G' argument, nscript generates gaudy output that includes header information on each page. The '-2' argument generates two column output and '-r' rotates the job's orientation to landscape mode.

enscript

GNU enscript is coming soon!

lprm

Use `lprm -Pprintername` to remove the first removable job from the print queue printername. You can remove a specific job from the queue by specifying its id as an argument and you can remove all removable jobs from a queue with the argument all. lpq

Use 'lpq -Pprintername' to get the status of the queue named printername. With no further arguments, it will print the printer queue, the host queried, and the number of jobs in the queue. With the -l argument, it will specify the id, queue rank, the total size of the job in bytes, and any errors encountered in processing the job.

lprm

Use 'lprm -Pprintername' to remove jobs from the queue named printername. With no further arguments, it removes the first removable job in the queue. Given a job's id as an argument, it will remove the specified job from the queue.

You are able to remove items from the queue that you have submitted from anywhere, not just the computer from which the job was submitted. Basic Tasks

Generate Postscript

Postscript is a Page Description Language that is understood by high quality printers and typically generated by applications. There is a lot of documentation about using and programming in postscript, but for our purposes you'll just need to generate postscript from an existing text file.

You can generate postscript from an existing text file with textps. For example, to convert the Message of the Day file to a postscript file try `textps ... > file.ps`.

Preview your job

It's helpful to preview your postscript files before printing by calling Ghostview with `ghostview file.ps`.

Higher quality previewing is available using Ghostview's derivativegv. You can call it as `gv file.ps`.

Both commands should open a window that displays the contents of your postscript file.

Choose a print queue

All supported printers are listed at https://booboo.umiacs.umd.edu/printers.

You can check list all the print queues with `lpq -a` and you can list just a single queue (eg. ps2109) with `lpq -Pps2109`.

Send a print job

After you choose a suitable printer (eg. ps2109), you can send your postscript file to the printer with `lpr -Pps2109 file.ps`.

Monitor a print job

You can monitor the job you sent to the printer (eg. ps2109) with `lpq -Pps2109`.

Lpq will return the following output:

[herzog 33] lpq -Pps2109
Printer: ps2109@durer (dest raw@ps2109.umiacs.umd.edu) 'HP 8550 in AVW 2109'
Queue: 2 printable jobs
Server: pid 11833 active
Unspooler: pid 11837 active
Status: waiting for subserver to exit at 14:50:45.141
Rank   Owner/ID                  Class Job Files                 Size Time
active fmccall@herzog+198           A   198 file.ps               4309 14:50:44
2      bargle@prime+199             A   199 hpss.ps               4309 14:50:45
Active connection from  128.8.120.247
Waiting connection from 128.8.120.247

Remove a Print Job

If you would like to remove your job from the queue, you should get the job's id from the output of `lpq`. You can remove it with `lprm -Pps2109 198`

From the output of lpq, I can see that the job id is 198 and I can remove it with lprm as follows:

[herzog 35] lprm -Pps2109 198
Printer ps2109@durer:
checking perms 'fmccall@herzog+198'
dequeued 'fmccall@herzog+198'