From Mageia wiki
Jump to: navigation, search

Printing to CUPS printers from Android or ChromeOS

ChromeOS devices can only print to cloud enabled printers. While most new printers are cloud enabled, there are an awful lot of classic non-cloud printers in use. In order to allow ChromeOS or mobile devices to print to a classic printer Google have created a feature in the Chrome browser to enable the Chrome (or Chromium) browser to act as a connector between the cloud and classic printers known to the computer on which the Chrome browser is running.

This page describes how to configure a headless server running CUPS print server to act as a connector between Google Cloudprint and any printers known to the cups server both locally, and on other cups servers.

Requirements

Install the chromium-browser package onto your CUPS server. You must have a working CUPS server. Go through the Printer GUI in Mageia Control Centre to set it up and add your printers.

Download generate_cloudprint_config.py from Google and unzip it into a convenient directory.

Run the script with

python generate_cloudprint_config.py

You will prompted for the information

  • Username - give a valid google account name
  • Password - give the google password for the account. If you use Google two stage authentication then get an application specific password from your Google account settings page.
  • Connector ID - A text descriptor to identify the connector
  • Print Server - Leave blank to connect to your local cups server.

A file will be generated with the name 'yourconnectorID.conf'. Copy this file to '/etc/cups/Service State' You have to do this as root user.

su
mv 'yourconnectorID.conf' '/etc/cups/Service State'

Now you need to create a systemd unit to start the connector on boot. Using your favourite text editor (I prefer nano) create the file /etc/systemd/system/googleprint.service containing the text

# This file starts the googleprint connector which is part of the chromium-browser package
# Before starting the service for the first time create the googleprint configuration file
# as described in the wiki https://wiki.mageia.org/en/Cloudprinting_to_CUPS

[Unit]
Description=Googleprint connector service
After=cups.service
Requires=cups.service

[Service]
Type=simple
Restart=on-failure
ExecStart=/usr/bin/chromium-browser --type=service --enable-cloud-print-proxy --no-service-autorun --noerrdialogs --user-data-dir=/etc/cups

[Install]
WantedBy=multi-user.target

Now reload systemd and enable the unit with

systemctl daemon-reload
systemctl enable googleprint.service

Now start the service

systemctl start  googleprint.service
systemctl status  googleprint.service

You can check that Google Cloud print can see your CUPS printers at https://www.google.com/cloudprint#printers

Now any Android or ChromeOS device should show your CUPS printers in their lists of available printers, and you should be able to print from any location.

Other Solutions

There is a github project called cloudprint which performs the same function as the cloudprint connector in chromium which saves having to install chromium-browser.