Sometimes when I'm working on my laptop, I want to queue up a few documents to print later, since I'm not connected to a printer at the time.
However, actual printer queues are not designed for this; they immediately try to print the document, and all suddenly start printing as soon as I get on the network, which is not generally what I want to do. Moreover, sometimes I want to change the order of documents in the queue, which is not very easy, particularly once some of them have started printing.
Also, sometimes printing fails because e.g. the printer runs out of paper or toner, and I want to re-print the document to a different printer. This is not straightforward with e.g. CUPS
or system-config-printer
; I generally have to go back, re-open the PDF reader, and start over again. None of the PDF readers I know let you keep a list of documents to print later, but this might be a hidden feature of a PDF reader somewhere that I don't know about.
Anyway, here's what I want to be able to do:
- Specify a list of PDFs I want to print.
- Keep that list on disk so that I can close the application or reboot without losing the entire list.
- Specify the printer(s) I want to send them to in advance without being actually connected to those printers at the time.
- Specify printing options like color, duplex, and number of copies.
- Change those printer assignments and print options later.
- Wait until I press a button or run a command to actually print the document(s).
- Keep a separate list of documents that have already been printed, in case the printing doesn't work or I want to reprint them later.
I know I could hack something together with a shell script, lpr
, and a list of paths in a text file, but I can't help feeling that this problem has already been solved in a more robust and elegant way.
Bonus points:
- Don't require that the documents be open in a PDF reader. I want to print them, not browse them, and there's no reason they have to be the same application.
- More than one list.
- Also work for Postscript, DjVu, and other page-description formats.
- Drag and drop from file managers.
Any suggestions?
What I do is the following --- it is not as versatile as you asked, but it works almost ok. You need to have all your printers defined, and then you need these two scripts:
stop_printers
:start_printers
:You have to put them in your path (for example
~/bin
) and make them executable withchmod +x
. CAVEAT: I do not have any printer with spaces in their names. The scripts are not tested in that case (but I am sure that one of our shell script's gurus will fix the scripts in a flash ;-)... )Now, you can issue:
And you can print from wherever you want, the printer will be paused:
You can see your queue:
(AFAIK, the print queues are persistent across reboots). And when you want to print:
Using
lprm
you can remove a job if you need to;lpr
to enqueue a document via command line, and if you want different "lists", no one forbids defining the same printer several times with different names.You can also resume each printer by hand, it's just a matter of running
cupsenable <printername>
from the prompt.What I do not think you can do with this solution is changing the print options after the fact --- you will have to dequeue and re-enqueue the document for this.
My package (shameless plug), duplexpr does some of what you want and includes bash functions which may be useful in rolling your own version. (It's coded in bash, so it should be relatively easy to modify and I will help if I can.)
It's designed to emulate duplex printing on non-duplex printers and implements its own simple print queue management. It has both gui and cli interfaces.
The current version only prints in duplex and only works with non-duplex printers, but a new version is in the works which will handle printers with duplex hardware which essentially is just printer and queue management without the duplex emulation software. (I have an alpha version available of a script which already works if anyone wants to contact me directly via the project, etc..)
The system prints to the current default printer, but the dplx and duplex scripts accept additional arguments which are passed to lp and can be used to set any options that lp understands such as printer and other properties.
The system currently handles PDF, PostScript, and plain text files.
The one thing it will not do is print files which were created using the Print to File option from within Acroread. Those files just don't work with lp and I have never been able to get the attention of any of the upstream folks to figure out what the problems are.
Personally, I print almost everything "offline" (using the Print to File options which most applications support) even when my printer(s) are available. It helps me concentrate on what I am doing. Later, when I reach a suitable break point, I print batches of jobs.
Having a print queue is also really nice when you want to print another copy of something without having to regenerate it and it's essential for dealing with printer errors like jams or running out of toner.
There doesn't seem to be a complete solution for this problem, but here's a function I added to my
.bashrc
that is similar to Rmano's answer above, with the additional convenience of autocomplete.