Introduction: Google Cloud Print With Raspberrypi

Could a USB label printer work with Google cloud print? You can do a lot with Raspberrypi and Python code, so why shouldn't this be possible. Well, it can. Follow these steps and you're printer is ready for Google Cloud Print in no time.

Step 1: Installation of a Raspbian Image

Creating the SD card with a raspbian image from Linux is easy, just do the following:

sudo dd bs=4M if=2017-02-16-raspbian-jessie-lite.img of=/dev/sdc

(The "/dev/sdc" is the SD card reference on my PC, on your PC it could be another reference. To find this reference just use: sudo fdisk -l. The SD card reference is listed in as one of the hard disk entries)

Step 2: Enabling the SSH Connection on Raspberrypi

Connect a keyboard and screen to the Raspberrypi. For the raspbian image the username and password login is standard "pi:raspberry"

Once logged in, go to the configuration for raspberrypi. On the Raspberrypi type "sudo raspi-config".

Select "5. Interface options", next select "P2 SSH". Press "enter" and a new window appears asking "would you like the ssh server to be enabled?". Select "Yes" and press "Enter".

Exit the program by selecting "Finish".

Now we can access the Raspberrypi remotely with ssh. You can remove the keyboard and screen from the Raspberrypi now.

Step 3: Installation of the Print Service Packages

Login into the raspberrypi with SSH.

"ssh pi@raspberrypi.local"

On linux, cups provides printer services. So, we need to install all necessary cups packages.

"sudo apt-get install cups libcups2-dev libcupsfilters-dev libcupsimage2-dev"

And now it's time for a coffee break. This will take a while to install the packages on the raspberrypi

Step 4: Install the Python Packages

We're almost there. Still some installation to do.

"sudo apt-get install python-dev python-pip"

We can now add new python modules to our Raspberrypi.

Step 5: Installing the Drivers for the Printer

My label printer is a Leitz Icon. For this printer, Linux drivers are available and can be compiled for the Raspberrypi.

First copy these files from you're PC to the board. From a Linux terminal do:

"scp LeitzIconDriversForLinux1.0.3.zip pi@raspberrypi.local:/home/pi"

On the Raspberrypi, unzip this file. "unzip LeitzIconDriversForLinux1.0.3.zip".

Go into the created folder ("cd LeitzIconDriversForLinux1.0.3") and build the driver.

"sudo ./install.sh"

Step 6: Installing the Cloud Printing Package

First, add the pi user as a member of the lpadmin group.

sudo usermod –a –G lpadmin pi

I would like to install the printer with the cups admin webpage.

sudo cupsctl –remote-admin

And the final package to install is cloudprint.

sudo pip install cloudprint

From this point forward is going to be easier. Just following screenshots.

Step 7: Using the Cups Admin Webpage

Plug in the printer into a free USB port of the Raspberrypi.

Now, startup up the webpage "https://raspberrypi.local:631/".

We need to add the printer to CUPS, so select "Adding Printers and Classes", and in the next webpage select "Add Printer".

Oh no, authentication for this printer. Relax, it's the same password as before (username:password=pi:raspberry)

Step 8: Adding the Label Printer

In my case, I want to install the local printer named "Leitz Icon(Leitz Icon)". So select the printer and press "Continue"

Step 9: Configure the Printer Name

You could give the printer a new name. For me the name was fine, so just press "Continue"

Step 10: Configure the Printer

Easy. Just press "Add Printer"

Step 11: Default Printer Settings

Same as before. Just keep all the settings and press "Set Default Options"

Step 12: Succes, Printer Is Ready

Yep. The label printer is ready to be used. Oh wait, I want to use it with google cloud print. Still a few steps to go.

Step 13: Startup Google Cloud Print

On the Raspberrypi, type "cloudprint". In the same terminal type in your google credentials like. If the application doesn't discover the google cloud print service. Just kill the application and restart it again.

The cloudprint application will report back an url like "https://goo.gl/printer/QytZt". Copy the url and paste it into a webbrowser. Now register the printer.

When the registration is complete the following messages appear on the Raspberrypi.

Printer claimed by x.y@gmail.com.

Polling for jobs on Leitz_Icon.

Establishing connection to xmpp server talk.googl.com:5223.

Xmpp connection established"

Step 14: Done

Success, the printer can now be used with google cloud print. Of course this tutorial works for other USB printers. It all depends, if the company that makes the printer has Linux drivers.

As a bonus, your Raspberrypi is now a printer server for a lot more printers. Just add the new printers with the CUPS admin webpage.

Comments

author
jdullaert (author)2017-09-07

Yes, add the cloudprint to the init scripts.

either copy the "cloupprint" to the folder /etc/init.d/

if this doesn't work you need to add a symbolic link;

ln -s /etc/init.d/cloudprint /etc/rc.d/

author
PaulC511 (author)2017-09-03

Thanks, worked my way through and got my Ricoh laser print connected to Google Cloud Print.

One question, it seems to need launching (cloudprint in the terminal) after every boot.

Is there a way to make this automatic on startup?

author
Swansong (author)2017-03-06

That's a neat setup :)