UNIXPrinting: Difference between revisions

From UMIACS
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
(9 intermediate revisions by 6 users not shown)
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


The basic commands you will use are:
==lpr==
 
* lpr
* nscript
* enscript
* lprm
* lpq
 
=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 22: 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=
==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 30: Line 20:
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-
==lprm==


GNU enscript is coming soon!
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 and you can remove all removable jobs from a queue with the argument "all".


=lprm=
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.


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==
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.
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=
==Generate Postscript==
 
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.
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 54: Line 36:
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 62: Line 44:
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.
Print queues are described here: [[PrinterQueueNaming | Print Queues]].


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 `lpq -Pprintername` -- eg. ps432-3208 with `lpq -Pps432-3208`.


=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. ps432-3208), you can send your postscript file to the printer with `lpr -Pps432-3208 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. ps432-3208) with `lpq -Pps432-3208`.


Lpq will return the following output:
Lpq will return the following output:


  [herzog 33] lpq -Pps2109
  [herzog 33] lpq -Pps432-3208
  Printer: ps2109@durer (dest raw@ps2109.umiacs.umd.edu) 'HP 8550 in AVW 2109'
  Printer: ps432-3208@lpr1 (dest raw@ps432-3208.umiacs.umd.edu) 'HP M653 in IRB 3208'
  Queue: 2 printable jobs
  Queue: 2 printable jobs
  Server: pid 11833 active
  Server: pid 11833 active
Line 85: Line 67:
  Status: waiting for subserver to exit at 14:50:45.141
  Status: waiting for subserver to exit at 14:50:45.141
  Rank  Owner/ID                  Class Job Files                Size Time
  Rank  Owner/ID                  Class Job Files                Size Time
  active fmccall@herzog+198          A  198 file.ps              4309 14:50:44
  active username@herzog+198          A  198 file.ps              4309 14:50:44
  2      bargle@prime+199             A  199 hpss.ps              4309 14:50:45
  2      username2@prime+199           A  199 hpss.ps              4309 14:50:45
  Active connection from  128.8.120.247
  Active connection from  128.8.120.247
  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 -Pps432-3208 198`


From the output of lpq, I can see that the job id is 198 and I can remove it with lprm as follows:
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
  [herzog 35] lprm -Pps432-3208 198
  Printer ps2109@durer:
  Printer ps432-3208@durer:
  checking perms 'fmccall@herzog+198'
  checking perms 'username@herzog+198'
  dequeued 'fmccall@herzog+198'
  dequeued 'username@herzog+198'
 
Often the last job listed in the printer queue has already spooled to the printer, and lprm will be unable to delete the job.  In this case, the only way to cancel the job will be to press the 'cancel' button on the printer.

Latest revision as of 15:46, 7 May 2021

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.

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.

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 and you can remove all removable jobs from a queue with the argument "all".

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.

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.

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

Print queues are described here: Print Queues.

You can check list all the print queues with `lpq -a` and you can list just a single queue `lpq -Pprintername` -- eg. ps432-3208 with `lpq -Pps432-3208`.

Send a print job

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

Monitor a print job

You can monitor the job you sent to the printer (eg. ps432-3208) with `lpq -Pps432-3208`.

Lpq will return the following output:

[herzog 33] lpq -Pps432-3208
Printer: ps432-3208@lpr1 (dest raw@ps432-3208.umiacs.umd.edu) 'HP M653 in IRB 3208'
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 username@herzog+198           A   198 file.ps               4309 14:50:44
2      username2@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 -Pps432-3208 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 -Pps432-3208 198
Printer ps432-3208@durer:
checking perms 'username@herzog+198'
dequeued 'username@herzog+198'

Often the last job listed in the printer queue has already spooled to the printer, and lprm will be unable to delete the job. In this case, the only way to cancel the job will be to press the 'cancel' button on the printer.