Google CloudPrint on Linux

Google [CloudPrint](http://www.google.com/cloudprint) allows users to print to the cloud from devices such as your mobile phone. That is, you can print things from your phone to printers you have access to (e.g., at home) but is not directly connected to your phone. As of 5/12/2011, only printing from mobile Gmail and Google Docs (from the browser) are supported besides the Chrome OS. Currently, only printers that are accessible to computers running Windows or Mac with the Chrome browser installed are supported. What about Linux? [This](http://www.linuxquestions.org/linux/answers/applications_gui_multimedia/howto_use_google_cloud_print_linux) thread points to the [cloudprint](https://github.com/armooo/cloudprint/) python program. I installed it and have it started at startup via the following:

git clone https://github.com/armooo/cloudprint.git
sudo apt-get install python-pip
sudo pip install daemon
sudo python setup.py install
## or skip the whole git process and do: sudo pip install cloudprint
## place content daemon script in /etc/init.d/cloudprint
sudo chmod +x /etc/init.d/cloudprint

where the daemon script was adapted from [this](http://www.linuxquestions.org/linux/answers/applications_gui_multimedia/howto_use_google_cloud_print_linux):

#!/bin/bash
# /etc/rc.d/cloudprint
# Description: Starts the Google Cloud Print script on startup
# ----------------
#
### BEGIN INIT INFO
# Provides: Cloud-Print
# Required-Start: $cups $network $local_fs $syslog
# Required-Stop: $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Start Google Cloud Print
### END INIT INFO

case $1 in
   start)
      echo -n "Starting Google Cloud Print: "
      ##/root/cloudprint/cloudprint.py
      sudo -u vinh cloudprint -d
   ;;
   stop)
      echo -n "Stopping Google Cloud Print: "
      ##killall cloudprint.py
   ;;
   restart)
      # echo -n "Restarting Google Cloud Print: "
      ##killall cloudprint.py
      ##/root/cloudprint/cloudprint.py
      killall cloudprint
      sudo -u vinh cloudprint -d
   ;;
# echo "Usage: cloudprint {start|stop|restart}"
esac

Then, add it to the startup list: `sudo update-rc.d cloudprint defaults`.

Make sure you log in manually [at least once](https://github.com/armooo/cloudprint/issues/14#comment_1149871) so that you can enter your username and password.

UPDATE 5/19/2011: I modified the init script so that I can print from a particular user. That way, if I print to [cups-pdf](http://blog.nguyenvq.com/2011/05/12/cups-pdf-example/), my files will be in `~/PDF/`. When cloudprint is run as root, I don’t know where the PDF’s generated from cups-pdf are. The [README](http://www.cups-pdf.de/cups-pdf-CURRENT/README) and `/etc/cups/cups-pdf.conf` documentation states that outputs are always in `$HOME/PDF`, and anonymous files are stored in `/var/spool/cups-pdf/ANONYMOUS`. However, I do not see the files in these locations. Therefore, I will just run cloudprint as my myself instead of root.

Also, I discovered [PrinterShare](http://www.printeranywhere.com/), a pretty useful printing app for Android devices.

11 Comments

  • DJJo
    May 15, 2011 - 11:48 am | Permalink

    when i installt it on my ubuntu 10.04 server. i get
    “No module named cups”

    I think i need to install something.

  • May 16, 2011 - 8:10 am | Permalink

    You will need to install cups: sudo apt-get install cups.

    • DJJo
      May 16, 2011 - 8:34 am | Permalink

      I got cups and a printer installed.
      on my desktop(11.04) does it work.

  • Pingback: Steven Nay

  • Pingback: junichi_y

  • RomanG
    May 31, 2011 - 5:54 pm | Permalink

    You need to install python module cups, run: apt-get install python-cups

  • Pingback: Helmuth B

  • Pingback: Imprimer depuis sont téléphone - danychouinard.net

  • undrline
    July 14, 2011 - 10:23 pm | Permalink

    Cloud Print is available for Chromium > 11.
    Enter this into the address bar:
    about:Flags
    This will open a page showing many disabled features. Go to the “Cloud Print Proxy” entry, and click on the “Enable” link.
    You will have to restart the browser in order for the change to fully take effect.
    Then wrench>Preferences>Under The Hood>Google Cloud Print will then be available.

  • glenn
    September 16, 2011 - 8:36 am | Permalink

    I modifed the init script to use debian startup functions. I couldn’t find a good way to log the output to syslog, but so far so good (hopefully this looks okay):

    !/bin/bash

    /etc/rc.d/cloudprint

    Description: Starts the Google Cloud Print script on startup

    ----------------

    #

    BEGIN INIT INFO

    Provides: Cloud-Print

    Required-Start: $cups $network $local_fs $syslog

    Required-Stop: $local_fs $syslog

    Default-Start: 2 3 4 5

    Default-Stop: 0 1 6

    Description: Start Google Cloud Print

    END INIT INFO

    name of app

    DESC="Google Cloud Print"

    path to daemon

    DAEMON=/usr/local/bin/cloudprint

    user to switch to after startup

    RUN_AS=

    PIDFILE=/var/run/cloudprint.pid

    load in LSB functions (log_*)

    . /lib/lsb/init-functions

    do_start()
    {
    RETVAL=0
    start-stop-daemon --start --pidfile $PIDFILE --chuid $RUN_AS --make-pidfile --background --exec $DAEMON
    RETVAL=$?
    log_end_msg ${RETVAL}
    }

    do_stop()
    {
    RETVAL=0
    start-stop-daemon --stop --pidfile $PIDFILE
    RETVAL=$?
    log_end_msg ${RETVAL}
    }

    case $1 in
    start)
    log_daemon_msg "Starting $DESC"
    do_start
    ;;
    stop)
    log_daemon_msg "Stopping $DESC"
    do_stop
    ;;
    restart|force-reload)
    log_daemon_msg "Restarting $DESC"
    do_stop
    sleep 5
    do_start
    ;;
    *)
    echo "Usage: cloudprint {start|stop|restart|force-reload}"
    exit 3
    ;;
    esac

  • Pingback: Remote printing: Debian and Google Cloud Print | developer.shyd.de.

  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>