Found CUPS Cloud Print useful?
A Google Cloud Print driver for Linux, Mac OS X and any other OS which makes use of CUPS.
Installation
Ubuntu ( 11.10 or later ) or Linux Mint
Run in a terminal:
sudo add-apt-repository ppa:simon-cadman/cups-cloud-print sudo apt-get install cupscloudprint sudo /usr/lib/cloudprint-cups/setupcloudprint.py
Follow the instructions about providing your Google username and password, and you’re done.
Fedora, Centos/RHEL or other Yum-based distros
Create a file in /etc/yum.repos.d/cupscloudprint.repo with this text inside:
[cupscloudprint] name=cupscloudprint baseurl=http://niftyrepo.niftiestsoftware.com/rpm/ gpgcheck=0
Then run in a terminal:
sudo yum update sudo yum install cupscloudprint sudo /usr/lib/cloudprint-cups/setupcloudprint.py
Follow the instructions about providing your Google username and password, and you’re done.
Other Linux
- Gentoo Ebuild
Copy to local overlay and emerge -va cupscloudprint - Debian Deb package
dpkg -i cupscloudprint_20120513-1_all.deb - RPM package
rpm -i cupscloudprint-20120513-1.noarch.rpm - Arch Linux package
pacman -U cupscloudprint-20120513-1-any.pkg.tar.xz
Mac OS X – Temporarily removed due to critical bug
Install From Source
git clone git://github.com/simoncadman/CUPS-Cloud-Print.git cd CUPS-Cloud-Print/ ./configure sudo make install
Configuration
Run:
sudo /usr/lib/cloudprint-cups/setupcloudprint.py
Or ( if /usr/lib/cloudprint-cups/setupcloudprint.py doesnt exist, will depend on installation method and OS ):
sudo /usr/local/lib/cloudprint-cups/setupcloudprint.py
After it asks for Google Credentials ( it will only do this is the first time you have used CUPS CloudPrint, or your credentials are invalid ) it will then ask if you wish to add all printers from your Google Account.
If you say ‘Y’ here, it will add all printers that are currently not added to your CUPS install.
If you would prefer to add the printers manually, say ‘N’ here, and add a printer manually:
Add a new printer ( via http://127.0.0.1:631 or usual interface ) as a ‘Google Cloud Print’ network printer. Select the ‘Make’ as Google, and ‘Model’ as Cloud Print.
Supply the connection name as a simple URI pointing to the printer you want to setup, you can get these URIs from running:
/usr/lib/cloudprint-cups/listcloudprinters.py
Or ( if /usr/lib/cloudprint-cups/listcloudprinters.py doesnt exist, will depend on installation method and OS ):
/usr/local/lib/cloudprint-cups/listcloudprinters.py
Print a test page, to confirm it is working.
Assuming the test page prints correctly, installation is complete.



Installing from .deb package created file /usr/lib/cups/backend/cloudprint with inappropriate user id. Needed to change it to root:root and restart cups then. Otherwise it did not appear in CUPS add new printer page.
Thanks, I’ll apply a fix to the deb package.
The deb package is now upgraded with the permissions fix.
Thanks
Simon
Should the name of the printer really be “Save to Google Docs” with a uri of
cloudprint://Save%20to%20Google%20Docs
??
Either way I don’t see the pdf’s show up in my Docs listing even tho cloud print_log shows the pdf created and sent from my MacOS Lion machine.
Hi Everette,
I believe that previously the Google Print console did show ‘Print to Google Docs’ rather than ‘Save to Google Docs’, and I’ve just tried using ‘cloudprint://Save%20to%20Google%20Docs’ as a printer and I see it also fails to create any PDFs inside Google Docs, and also fails to error.
I’ve added an issue in GitHub for this , as it is clearly a problem, I also need to built an interface to list out printers for an account, as the printer naming CUPS Cloud Print needs are non-obvious.
Have you tried using cloudprint://Print%20to%20Google%20Docs as the URI? It seems to work fine on my Mac OS X Lion machine. If not, which version of Lion are you using ( eg 10.7.2 )?
There is also a known issue with Application-Specific passwords, which may be causing printing to fail if you have them enabled on your Google account.
Thanks
Simon
I’ve released a new version of CUPS Cloud Print, it includes a few fixes ( printing now fails when sending to a non-existent printer, Application-Specific passwords now work successfully ). The links above are now repointed to the new package urls.
Simon,
I tried to use your driver but when printing it shows error on Cups:
“Printer ‘Save%20to%20Google%20Docs’ not found”
Is there any log message i could send you to help on this issue?
Ademar
Hi Ademar,
Can you confirm what you have as your connection string in CUPS for the Printer?
It should be set to:
cloudprint://Print%20to%20Google%20Docs
Thanks
Simon
I’ve put a quick script together at :
https://raw.github.com/simoncadman/CUPS-Cloud-Print/c5d53cb5400773ba3c4716b8bd129fd018f017ca/listcloudprinters.py
Which lists the cloud printers for an account, it should just need to be downloaded and ran with:
python listcloudprinters.py
And should output something like this, with your own printers and URIs listed:
HP LaserJet Professional P1102w – cloudprint://HP%20LaserJet%20Professional%20P1102w
Print to Google Docs – cloudprint://Print%20to%20Google%20Doc
The script will be part of the next release of CUPS Cloud Print.
Simon
Simon,
First of all nice JOB, that is what was missing to use this.
I get error “Printer ‘Save%20to%20Google%20Docs’ not found”.
And you can see here that the name of my printer at Google Cloud print is correct = https://sites.google.com/site/ubuntu4us/artigos/configuracao-de-hardware/impresoes-e-impressoras/impressao-via-google-cloud-no-ubuntu/Cloud%20Print.png?attredirects=0
See error log bellow: /var/log/cups/cloudprint_log
Printing file /tmp/3347-anonymous-cupsjob-10985
Running /usr/lib/cloudprint-cups/submitjob.py
Converted to PDF as /tmp/3347-anonymous-cupsjob-10985.pdf
Sending /tmp/3347-anonymous-cupsjob-10985.pdf to cloud
ERROR: Printer ‘Save%20to%20Google%20Docs’ not found
/tmp/3347-anonymous-cupsjob-10985.pdf sent to cloud print, deleting
Deleted /tmp/3347-anonymous-cupsjob-10985
Deleted /tmp/3347-anonymous-cupsjob-10985.pdf
Error log for /var/log/cups/error_log
At this link: https://sites.google.com/site/ubuntu4us/artigos/configuracao-de-hardware/impresoes-e-impressoras/impressao-via-google-cloud-no-ubuntu
Hope to have your help.
I am using ubuntu lucid.
Simon,
I saw your reply just now.
Using your script I can see that Google cloud print changes the name of this printer on screen.
The result of your script is:
\\\PDF – cloudprint://%5C%5C%5CPDF
\\\Photosmart_C7200 – cloudprint://%5C%5C%5CPhotosmart_C7200
\\\Photosmart_C7200_fax – cloudprint://%5C%5C%5CPhotosmart_C7200_fax
Print to Google Docs – cloudprint://Print%20to%20Google%20Docs
So changing my printer name to cloudprint://Print%20to%20Google%20Docs instead of cloudprint://Save%20to%20Google%20Docs saved my problem.
Thanks again. Really nice work.
Great, thanks for letting me know how you solved your problem. Happy to help.
Simon
Another update has now been released, download links and instructions above updated, it now includes a setup script which creates the configuration file, and can add all Google Cloud Print printers to CUPS.
Simon
Simon,
Great work again.
I am experiencing the following error: when i try to print a PDF file it fails with log (/var/log/cups/error_log):
printer-state-message=”/usr/lib/cups/backend/cloudprint failed”
printer-state-reasons=none
I could guess: Maybe it should simply send pdf files instead of convert to pdf again before sending…
Best regards.
I hit a nasty problem with the OSX package that’s currently available at the time of this comment. Forgive the sarcasm that may be present, it’s one of those days…
A log, /var/log/cups/cloudprint_log, is included in the pkg. Ordinarily, I wouldn’t see this as a problem however it appears that the Package Installer will make sure all folders in a path exist and that they are actually folders instead of links or something else. This means that it will check to see if /var is a folder. If it isn’t, it will erase /var and recreate /var as a folder… this is rather unfortunate as in OSX, /var is a symlink to /private/var. In /private/var are important things like the sudo database, the PAM database, and other things that are typically referred to as /var/path/to/thing. You can probably see the problem by now. Yes, this is a bug in the OSX Package Installer, so I should be reporting this to Apple but the odds of Apple fixing the Package Installer in Leopard are slim so… that being said, you should probably remove the reference to the log from the installer pkg.
Hi Kevin,
Thanks for the information, that sounds pretty serious – I didn’t encounter the same issue on Lion, I have pulled the package for Mac OS X until I can remove the log from the package and test it on older versions of OSX.
Thanks
Simon
Hi Ademar,
I’ll add some code to only convert to a PDF only if the file isn’t a PDF.
Thanks
Simon
Worked like a charm, thank you very much!
very useful
I’m using arch linux x86_64,
since I installed both python 2 and 3 i had to modify all the .py files from #! /usr/bin/python
to
#! /usr/bin/python2
and now it’s working perfectly.
It works great! Thank you, you solved me a problem at work!
Excellent work!
I tried it in Debian and it works perfectly. I just got one issue, due to the unavailability of the two side option. Did someone else apart me address the same problem? To better understand, the CUPS version I use is 1.5.2.
Thanks for any help.
Just installed on Snow Leopard.
Initially I run it as per your instructions. Nothing worked and printer came in as corrupted entries.
I reinstalled with sudo and all seemed fine.
If I let the script add the printer, entries are still corrupt.
Under CUPS web interface.
Printer is created as \\\CUPS_PDF with the slashes in front.
When I go into the details, it is listed as.
Description: {printer_info}
Location: {printer_location}
Driver: {printer_make_and_model} (grayscale)
Connection: {device_uri}
Defaults: job-sheets={job_sheets_default} media=unknown
It seems to not pull the actual details from Google.
Now I can not delete these entries. I get the error “Unknown operation “delete-printer”!”
How do I manually delete the printers? I can not delete via the web interface.
Got the printers deleted
I modified the printers.conf and removed the 3 slashed from the printer name.
sudo nano /etc/cups/printers.conf
Then I restarted CUPS Not sure if this is the correct way but it worked.
sudo launchctl stop org.cups.cupsd
sudo launchctl start org.cups.cupsd
Now I am able to delete the printers. The printer with the changed name still does not print correctly. For now it will be manual setup.
Can you add the prefix the the printer names?
The printers I have added manually, I created as GC_printername.
I now share the printer via DNS-SD and the printers are displayed on the iPAD as an AirPrint printer. As I can only see the printer names, it would be great the add a prefix to the name to be more descriptive. b.t.w the AirPrint option works under Ubuntu as well, just choose “Allow printing from internet” option.
We now have AirPrint via Google Cloud Print thanks to your work.
Is your app supposed to only print outbound or can it listen for incoming print jobs as well? Similar to https://github.com/armooo/cloudprint
Your work, its great, makes mine a lot easier, keep up the great work.
you should put a paypal donate button.
Thanks
Hi Ewan,
This app only prints outbound, if you want to print over Cloud Print to a printer without native Cloud Print support you will need to also use the app from https://github.com/armooo/cloudprint to act as the print job listener. Google Chrome can also now act as a Google Cloud Print proxy ( ie listen for print jobs ) on Mac, Windows and Linux .
Hi Ewan,
Your issue with a printer appearing as “\\\CUPS_PDF” sounds very odd, the only thing I can suggest is a previous printer entry left over from previously installed software ( ie CUPS PDF ) somehow causing issues.
Did you manage to run the setupcloudprint.py script successfully, or did it report any errors? The setup script doesnt currently support adding prefixes currently, but I can look at adding it as I can see how it would be useful. Creating printers manually should let you add printers with any name, which it sounds like you’ve already worked out ( you should also be able to add the printers using the setup tool then edit the name in the cups configuration file ).
AirPrint via Google Cloud Print sounds like an interesting application, something I haven’t previously considered, sounds very useful!
Thanks
Simon
Pingback: Google Cloud Print unter Ubuntu einrichten | Softwareperlen
Hi Ewan,
The latest builds ( 20120422 or above ) now have prefix support in the setup script. When setting up new printers ( via the setupcloudprint.py script ), it asks for an optional prefix.
Simon
Strange, since a few days, i get this error message on cups 1.5.2 on ubuntu 12.04:
held since
Thu 10 May 2012 08:30:12 PM CEST
“/usr/lib/cups/backend/cloudprint failed”
I’ve reinstalled the package several times, and deletes the /etc/cloudprint.conf file, and printers, but nothing helps …
And the logfile is not written anymore …
Regards,
Jean-Luc
Hi Jean-Luc,
Do you have anything being written at all in /var/log/cups/error_log or /var/log/cups/cloudprint_log when you try to print? Do you get any output if you run:
sudo /usr/lib/cups/backend/cloudprint
Within a terminal? Can you also send the output of:
apt-cache show cupscloudprint
Thanks
Simon
Hello Simon,
I only get this in the page_log file:
GCP-Save_to_Google_Docs jean-luc 382 [11/May/2012:18:37:48 +0200] 1 1 – localhost Test page – -
And this in the access_log file:
localhost – - [11/May/2012:18:37:48 +0200] “POST /printers/GCP-Save_to_Google_Docs HTTP/1.1″ 200 428 Print-Job successful-ok
If i run the script , i get this output:
jean-luc@desktop:/var/log/cups$ sudo /usr/lib/cups/backend/cloudprint
[sudo] password for jean-luc:
network cloudprint “Unknown” “Google Cloud Print”
The print job state is still “Help” after a few minutes
After some time , i get such an error in the error_log file:
E [11/May/2012:18:40:14 +0200] [Job 379] Stopping unresponsive job!
Here is the output of “apt-cache show cupscloudprint”:
Package: cupscloudprint
Priority: extra
Section: net
Installed-Size: 94
Maintainer: simon cadman
Architecture: all
Version: 20120423-1
Depends: cups, python-cups
Filename: pool/main/c/cupscloudprint/cupscloudprint_20120423-1_all.deb
Size: 10504
MD5sum: 5011e6980b3ae2a8c7e0dcb8f05e5244
SHA1: 71d361bbf3c77d8b7a1e82f3d0f0516aaf02d0c7
Description: Print via Google Cloud print using CUPS
Print via Google Cloud print using CUPS, useful when you need to print via a printer which does not have Linux support, but does support Google Cloud Print.
Best regards,
Jean-Luc
Hi, after some searching , i found the problem :
D [11/May/2012:19:19:12 +0200] [Job 382] File “/usr/lib/cups/backend/cloudprint”, line 70, in
D [11/May/2012:19:19:12 +0200] [Job 382] logfile = open(‘/var/log/cups/cloudprint_log’, ‘a’)
D [11/May/2012:19:19:12 +0200] [Job 382] IOError: [Errno 13] Permission denied: ‘/var/log/cups/cloudprint_log’
D [11/May/2012:19:19:12 +0200] [Job 382] Backend returned status 1 (failed)
D [11/May/2012:19:19:12 +0200] [Job 382] End of messages
D [11/May/2012:19:19:12 +0200] [Job 382] printer-state=3(idle)
D [11/May/2012:19:19:12 +0200] [Job 382] printer-state-message=”/usr/lib/cups/backend/cloudprint failed”
I’ve done a chmod 777 on the logfile, and now it works, but after a logrotation it will fail again.
Which user is running the print python job? maybe i’ve to make it part of the lp or lpadm group?
Regards,
Jean-Luc
Some access rights are not correct, i’ll try to fix them
Hi,
The script runs under the lp user on Ubuntu. It looks like the problem is the logrotate is creating files with the root user and lpadmin group, which as you’ve discovered, prevents the script from writing to it. I’ve added two issues on Github so that in the next release the script doesnt fail if it can’t write to the log file, and hopefully add a logrotate script to fix permissions of the cloudprint log file.
Thanks
Simon
I’ve released a package which should fix the two issues. It looks like on Ubuntu the cups backend file has the wrong file permissions, which causes the script to run as a lower privilege user, which then cant recreate it’s log file.
Thank you Simon
Thank you for the donation