Ubuntu – “Print it later” software

pdfprintingsoftware-recommendation

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?

Best Answer

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:

  1. stop_printers:

    #!/bin/bash -f
    #
    allp=(`cat /etc/printcap | tr "|" "\t" | cut -f 1 | grep -v "#"`)
    for i in ${allp[@]}; do 
        echo -n Printer $i:
        cupsdisable "$i"
        echo " " paused.
    done
    
  2. start_printers:

    #!/bin/bash -f
    #
    allp=(`cat /etc/printcap | tr "|" "\t" | cut -f 1 | grep -v "#"`)
    for i in ${allp[@]}; do 
        echo -n Printer $i:
        cupsenable "$i"
        echo " " restarted.
    done
    

You have to put them in your path (for example ~/bin) and make them executable with chmod +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:

[romano:~] % stop_printers
Printer PDF:  paused.
Printer ColorDEA:  paused.
Printer Deskjet_6980:  paused.
Printer fotocop5:  paused.

And you can print from wherever you want, the printer will be paused:

printer from evince

You can see your queue:

[romano:~] % lpq -PDeskjet_6980
Deskjet_6980 is not ready
Rank    Owner   Job     File(s)                         Total Size
1st     romano  439     Bones_3+RG.pdf — Flesh depth  125952 bytes

(AFAIK, the print queues are persistent across reboots). And when you want to print:

[romano:~] % start_printers         
Printer PDF:  restarted.
Printer ColorDEA:  restarted.
Printer Deskjet_6980:  restarted.
Printer fotocop5:  restarted.

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.