Printing (PDF) to uPrint printers at McGill from GNU/Linux

It’s been six months since I notified McGill ICS of an update for their page on using the campus uPrint service from GNU/Linux.

They haven’t updated anything, so this is to explain how to do it. This change is relevant only to Ubuntu 13.04 and later versions,  and maybe other flavours. For details and discussion, see this bug discussion.

Also, below, I treat the question of how to print to uPrint, once it’s set up. This is all easy and shorter than this whole blog post.

So, for Ubuntu 13.04, bring up a terminal (with Ctrl-Alt-t) and type the following lines, one by one (you’ll be prompted for your password the first time):

sudo echo "BrowsePoll" >> /etc/cups/cups-browsed.conf
sudo restart cups-browsed

That’s it.  Now you can print to any uPrint printer on campus… though not, unfortunately, from your printer dialogue. Update: By May 2014, this enabled printing from printer dialogs (careful, though; it defaults to one-sided.). (To test whether the above has worked, type “lpstat -p” in a terminal. You should see a list of some printers.)

The hints below are for printing from the command line. When I first got this working GUI printing to Uprint was not working. When I want to print something, I make sure it’s in PDF format. I then use a terminal; e.g. for file myfile.pdf, I type:

uprintpdf myfile.pdf

and that’s it.

For this to work, however, you need to find out your short McGill username (7 characters?) and put the following into (at the end of, for instance) your ~/.bashrc file, replacing MUSERNAME with your short user name:

uprintpdf() {
# 2012 Nov. This works nicely to print black and white to UPrint at McGill.
echo "Uprinting" &
pdftops "$1" /tmp/draftManuscript$$$!.ps
echo lp -U MUSERNAME -d mcgill-mono -o sides=two-sided-long-edge $2 $3 $4 /tmp/draftManuscript$$$!.ps
lp -U MUSERNAME -d mcgill-mono -o sides=two-sided-long-edge $2 $3 $4 /tmp/draftManuscript$$$!.ps 

Note that the above printer name (mcgill-mono) is found from running:

    lpstat -p

Update May 2014

As of May 2014 or earlier, McGill’s IT page says CUPS 1.6 and 1.7 (the latest) are not supported, and that they’re “working on a solution” for GNU/Linux users. However, it still works for me, although the printer names recently changed from having an underscore to a hyphen, which hung me up for a while!

Update April 2015

Still works in Ubuntu 15.04, though the hyphens turned back to underscores in the printer names(!).

I’ve shorthand for printing color and for the rare cases when I need to print single sided, so altogether, my .aliases includes the following (tab complete will find them if you type uprint and hit tab):

echo " I'm guessting the following only needs to be done once:"
echo "cupsctl "
echo "cupsctl Browsing=On"
echo "sudo restart cups-browsed "
echo "sudo service cups restart"
echo " and thereafter, lpstat -p gives :"
lpstat -p
echo "------------------"
echo "The above should read:"
echo "printer McGill-color is idle. enabled"
echo "printer mcgill-mono is idle. enabled"
echo "printer uPrint-Mono-Popup is idle. enabled"
echo "------------------"
echo "Printing options are (lpoptions -p mcgill-mono):"
lpoptions -p mcgill-mono
echo "------------------"
echo "To print:"
echo "lp -U [McGill Short Username] -d [printername] [filename] "
echo "where printername is the name of the printer as seen from the lpstat command; use either McGill-color or McGill-mono only."

#Yes, the following three bash functions should be combined!
uprintpdf() {
# This works nicely to print black and white to UPrint at McGill.
echo "Uprinting" &
pdftops "$1" /tmp/draftManuscript$$$!.ps
# mcgill-mono becomes mcgill_mono again in Ubuntu 15.04 !!
echo lp -U MUSERNAME -d mcgill_mono -o sides=two-sided-long-edge $2 $3 $4 /tmp/draftManuscript$$$!.ps
lp -U MUSERNAME -d mcgill_mono -o sides=two-sided-long-edge $2 $3 $4 /tmp/draftManuscript$$$!.ps 
uprintpdfcolor() {
echo "Uprinting color" &
pdftops "$1" /tmp/draftManuscript$$$!.ps
echo lp -U MUSERNAME -d McGill_color -o sides=two-sided-long-edge $2 $3 $4 /tmp/draftManuscript$$$!.ps
lp -U MUSERNAME -d mcgill_color -o sides=two-sided-long-edge $2 $3 $4 /tmp/draftManuscript$$$!.ps 
uprintpdfsinglesided() {
echo "Uprinting SINGLE SIDED" &
pdftops "$1" /tmp/draftManuscript$$$!.ps
echo lp -U MUSERNAME -d mcgill_mono -o sides=single $2 $3 $4 /tmp/draftManuscript$$$!.ps
lp -U MUSERNAME -d mcgill_mono -o sides=single $2 $3 $4 /tmp/draftManuscript$$$!.ps 

Update June 2015

The saga sadly continues. After over a month of not being able to print at all at work once again (oh, pining for the 1990s…!) and finding no solutions, I today noticed that the printers are back, albeit with new names again. Now I have UPrint_Colour_Popup and uPrint_Mono_Popup.

… but printing to them only worked fine for a while (June 2015), then seemed to work in the sense that jobs claimed to have been submitted but then nothing arrivee at the Uprint printer (July 2015), and then nothing worked at all, i.e. no printers are available /visible in CUPS (30 July 2015). I’m so embarrassed for my university and/or operating system….

Update April 2016

In February of 2016, I wrote the following to the McGill IT support people:

Hi. As a GNU/Linux user on campus, I’ve dealt with a steady stream of ever-new problems from Uprint over the last years trying to carry out simple printing.

Several months ago, Uprint stopped printing in grayscale for me and it stopped knowing what letter sized paper is.
I’m finally submitting a report about this, and to make it simple, I’m using one of NCS’s GNU/Linux machines: the Apollo server.

I copied the attached file (ungzipped) (it’s also in my home directory on Apollo) to two distinct names to distinguish the jobs below, and then issued the following commands on Apollo:
$lp -U mymcgillid -d mcgill_mono

request id is mcgill_mono-4 (1 file(s))

$lp -U  mymcgillid -d mcgill_mono -o media=letter

request id is mcgill_mono-5 (1 file(s))
The result is identical for the two jobs: (1) They fail to print initially, but come up with “Action needed” prompts, saying that the paper size is unknown. I have to choose a paper size and orientation from one of the paper supplies, manually. Then, (2) the job comes out in colour instead of mono.
These are not even the only problems I am having at the moment, but they are perfectly reproducible so I’m bothering you with them. It would be great to have this kind of basic functionality back.

The testpage, by the way, is a standard letter-sized test page from Hewlett Packard; I didn’t make it.


and 10 days later, having received no acknowledgement, I added:

In addition, many (longer) jobs simply fail to print. I arrive at the printer, go through the rigmarole described [above], and then the job looks like it’s about to print but hen it changes its mind and does “Overwriting” “Deleting” and the job disappears without a trace.  I’m attaching an example of such a file.
It’s been 10 days since I asked for help on this.


They responded, kindly saying that they were “escalating” the issue.  I’ve heard nothing since.

This entry was posted in GNU/linux, McGill University, software, Ubuntu and tagged , , , . Bookmark the permalink.

9 Responses to Printing (PDF) to uPrint printers at McGill from GNU/Linux

  1. Pingback: Ubuntu 13.04 (and 13.10) on Lenovo X230/X230T convertible tablet | The Red Pen

  2. This is genius. I was breaking my head for days trying to figure out why it wasnt working using McGill’s IT page.
    They should just point to your post.
    Thanks for this

  3. cpbl says:

    Ah, as of May 2014, it seems that printing from application GUIs’ printer dialogues works fine. So the command line scripts above are not longer key.
    Also: for me, the printer names recently changed.
    While that’s an improvement, and it seems to work, McGill’s IT page now says that CUPS is no longer supported.

  4. any updates on this? I can’t seem to print at all from my linux laptop, even after changing the underscore to a hypen

    • cpbl says:

      I think my printing to uprint stopped working just this week (ridiculous!).
      Was it ever working for you? It would be helpful to know, if I submit another help request to ICS.

      By the way, (staff, at least?) can print by email now. But it doesn’t work for me because I deleted my exchange account long ago, and the print-my-mail system won’t accept my using an SMTP server in the CS department.

      • the last time I remember it working was early August. I was away for a while, and only tried last week, then again yesterday. I don’t understand why there’s an issue in the first place… All the mac’s in the CS department in Trottier run Ubuntu

  5. cpbl says:

    Oddly, it seems I had to go into Ubuntu’s printer manager and click the “enable” box in the printer settings for the mcgill-mono: that released the hangup and I can now print mono. The colour printer isn’t working, still, however.

    • cpbl says:

      I’ve changed nothing on my end, but my print jobs go through again now — to both colour and grayscale UPrint devices.

  6. cpbl says:

    June 2015: Once again, I can no longer print. My CUPS shows no printers at all, despite restarts, etc. Interestingly, McGill’s own instructions now show similar advice to mine.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s