Differences between revisions 2 and 3
Revision 2 as of 2017-01-21 16:06:20
Size: 22456
Editor: Brian Potkin
Comment: Typos. Clarified PDL priority. Added section on legacy driverless printing. Mentioned PCLm.
Revision 3 as of 2018-07-23 15:21:22
Size: 23443
Editor: Brian Potkin
Comment: GCP sections: corrections, additions, deletions and rearrangements of the content. Acknowedgements-->Acknowledgements.
Deletions are marked like this. Additions are marked like this.
Line 232: Line 232:
[[https://support.google.com/cloudprint/answer/2541899?hl=en&ref_topic=4456286|here]].

{{{#!wiki note
Note that GCP will not register a CUPS print queue which does not have a
PPD associated with it because no printer capabilities can be found. A
connector will see such a queue as invalid and refuse to add it to the
Google account.
}}}

On receiving notification of a pending job the connector downloads the document and submits it to the printing system. The MIME media type of the file will be application/pdf.
[[https://support.google.com/cloudprint/answer/2541899?hl=en&ref_topic=4456286|here]]. On receiving notification of a pending job the connector downloads the document and submits it to the printing system.

 * Log into the Google account and go to the [[https://www.google.com/cloudprint#printers|printer management]] page to display the queues known to GCP and print to a chosen queue by uploading a file to GCP.
Line 268: Line 262:
Install the cloudprint package and, as a user, do Install the DebPkg:cloudprint package and, as a user, do
Line 280: Line 274:
to have it run in the background. to have it run in the background, or

{{{
cloudprint
}}}

to watch all the its output on the screen.
Line 285: Line 285:
brian@desktop:~$ cloudprint
Line 288: Line 289:
trying for the win trying for the win`
Line 297: Line 298:
 * The file .cloudprintauth.json will be created for account authententication credentials in the home directory.
 * The default is to include all [[#gcp|valid print queues]] known to CUPS.
 * Log into the Google account and then go to either the [[https://www.google.com/cloudprint#printers|printer management]] or [[https://www.google.com/cloudprint/gadget.html|print gadget]] page to display the queues known to GCP.
 * The file ''.cloudprintauth.json'' for account authententication credentials will be created in the home directory.
 * The default is to register all non-raw print queues known to CUPS for display in GCP.
Line 307: Line 307:
cloudprint does not recognise when the creation or deletion of a CUPS
queue takes place on the server so the event is not communicated to
Unlike [[#gcpc|google-cloud-print-connector]], ```cloudprint``` does not recognise when the creation or deletion of a CUPS
queue takes place on the server, so the event is not communicated to
Line 314: Line 314:

or stop and restart the cloudprint service. The [[https://www.google.com/cloudprint#printers|printer management]] page will have to be refreshed to see the new queue.
Line 323: Line 325:
 * The [[DebianPkg:cloudprint-service|cloudprint-service]] package provides a systemd service file if there is a preference for controlling cloudprint from the init system.  * DebianPkg:cloudprint-service provides a systemd service file if the preferred way is to start on system boot and control cloudprint from the init system. Install it, execute

{{{
cps-auth
}}}

with root privileges and use the provided URL to claim the queues.
 * ```cloudprint``` logs to the [[DebianMan:journalctl|journal]] in daemon mode (''-d'') or with a systemd service file [[DebianPkg:cloudprint-service|on the system]].
 * GCP will issue an error message (''Could not convert to PDF''.) when a text file does not have a ''.txt'' suffix.
 * Every file uploaded to GCP is converted by GCP to a PDF.
Line 328: Line 339:
Install google-cloud-print-connector. There are two programs, gcp-cups-connector-util and gcp-cups-connector, in the package.

gcp-cups-connector-util contains options for utility tools to create a
configuration file
, delete all print queues associated with the particular connector instance and manage print jobs. See all options with

{{{
gcp-cups-connector-util -h
}}}

To produce a configuration file, gcp-cups-connector.config.json, in your
home directory do

{{{
gcp-cups-connector-util init
}}}
Install DebPkg:google-cloud-print-connector. There are two programs, ```gcp-connector-util``` and ```gcp-cups-connector```, in the package.

```gcp-connector-util``` has options for the utility to create a configuration file, share a printer, delete all print queues associated with the particular connector instance and manage print jobs. See all options with

{{{
gcp-connector-util -h
}}}

To produce a configuration file, ''gcp-cups-connector.config.json'', in the home directory do

{{{
gcp-connector-util init
}}}

and follow the instructions to claim the print queues.
Line 348: Line 359:
or
Line 351: Line 363:
 * Logging by gcp-cups-connector is done to ''/tmp/cups-connector''.
 * Default queue registration is the same as with [[#cloudprint|cloudprint]].
 * The [[https://www.google.com/cloudprint/#printers|printer management web interface]] is used for deleting unwanted queues.
 * gcp-cups-connector will notice if queues are added or deleted on the CUPS server and automatically update GCP with the new information.

=== Acknowedgements ===
 * The default is to include all non-raw print queues known to CUPS for display in GCP.
 * Logging by ```gcp-cups-connector``` is done to ''/tmp/cloud-print-connector''.
 * ```gcp-cups-connector``` will notice when queues are added or deleted on the CUPS server and automatically update GCP with the new information. Refresh the [[https://www.google.com/cloudprint#printers|printer management]] page to see an updated list of queues.
 * This [[https://github.com/google/cloud-print-connector/wiki/Configuration|wiki page]] describes parameters for configuring the connector.
 * GCP will issue an error message (''Could not convert to PDF.'') when a text file does not have a ''.txt'' suffix.
 * Not every file uploaded to GCP is converted by GCP to a PDF. PDF, !PostScript, text and image files like jpg and png are submitted to CUPS exactly as they are sent.

=== Acknowledgements ===

Translation(s): none


Driverless printing with CUPS and Google Cloud Print.

IMPORTANT NOTE

Driverless printing with CUPS requires at least CUPS 2.2.2 and version 1.13.0 of cups-filters. On 19.01.17 the packages are available only in the experimental distribution.

The Concept of Driverless Printing

Driverless printing is targeted at the client side of printing and refers to the ability of the client device (computer, smartphone, tablet, laptop etc) to print without having to install any static capability files or drivers (manufacturer-specific or otherwise) on the client.

There is a variety of methods for a client to submit a job to a driverless printing system:

This page is intended to highlight and explain driverless printing using packages provided by Debian so not all these methods will receive attention here. Furthermore, details for using iOS and Android mobile clients are not treated.

Driverless Printing and Printers

A traditional printing system based on CUPS, cups-filters and cups-browsed generally obtains information about printer features and capabilities from what is stored in a static capability file such as a PostScript Printer Description (PPD) file. This static file is stored on the client device (desktop computer, laptop, tablet etc) itself. If the PPD on the client requires the sending of a job using a non-standardised Page Description Language (PDL) a driver would be required for converting to the printer-specific PDL and that driver too would have to be on the client. A client which regularly connected to different printers would have to maintain static capability files and drivers for each printer.

This is not seen as an acceptable situation for mobile clients, which may have limited storage for PPDs and drivers and which may lack resources, such as battery power. Neither is it deemed particularly realistic for a user to have to set up or reconfigure a mobile device for each printer which is encountered. This requires a level of expertise and a time and effort commitment which cannot be assumed to be possessed.

The response of printer manufacturers to the desire for driverless printing has been to enhance their printers in the following way:

  • The printer advertises its presence and capabilities with mDNS/DNS-SD (Bonjour). This is the discovery protocol; accessible printers can be identified and selected from the Bonjour broadcasts of the printer.The discovery protocol is also configured to obtain capability information from accessible printers to include in its broadcasts.

  • The client and printer communicate using the IPP protocol. This is the transport protocol; it can obtain capability information from the selected printer and transport data to the selected printer.
  • There is a common PDL (Page Description Language) which the client can send and which the printer will accept. The common PDL is based on what is obtained from the capability information for the selected printer. A driverless-enabled printer will offer at least one of Apple raster, PWG raster or PDF as a PDL.

Note that we are talking here about sending a job directly to a printer, not to a print queue being advertised by CUPS.

PDLs for Driverless Printing

Two raster formats, Apple raster and PWG raster, have been developed to implement driverless printing.

In the case of PWG raster the raster format was chosen because it is a simpler format than that of the high-level languages, which also require significant resources on the printer. Printer-embedded PostScript interpreters can be buggy and/or slow and PostScript also has the disadvantage that it makes interoperability between client and printer difficult because PostScript does not fit cleanly with the IPP and PWG models. Streaming was chosen to send a job to a printer rather than generating a file which which is downloaded and then printed. This way large jobs don't take up too much memory or storage space on the printer and printing commences with minimum delay.

  • Apple raster has existed for a number of years and is used with Apple's AirPrint. Unfortunately, it is not officially documented but it is known that it and PWG raster are very similar. The MIME media type is image/urf.

  • PWG raster is a more recent raster format, devised to be used with IPP Everywhere printers. It is based on CUPS raster and is well-documented. The MIME media type is image/pwg-raster.

CUPS: PWG and Apple Raster

The abilitity to create Apple raster files has been added to the existing PWG raster support in CUPS and made its appearence in CUPS 2.2.2; this enhancement was soon applied in version 1.13.0 of cups-filters and cups-browsed. Complete support for IPP Everywhere printers was already in Debian, so, with CUPS 2.2.2, AirPrint printers joined the class of printers which will work driverless with Debian.

With the incorporation of the two raster formats as a PDL in CUPS, IPP 2.0 to allow for querying the capabilities information from the printer and Bonjour/DNS-SD to find the printers in the network, Debian has everything needed for driverless printing to an IPP printer.

The processing of a job to create an Apple raster file is taken care of by CUPS' rastertopwg filter. The file produced by the filter is sent directly to the printer with IPP so no vendor-specific filters are involved. This opens up the possibility of avoiding the use of non-free drivers on the server used for printing.

Creating a Driverless Print Queue with lpadmin

Some familiarity with a device-uri is assumed in this section.

With a single AirPrint printer on the network a partial output from lpinfo -v could be:

network dnssd://HP%20ENVY%204500%20series%20%5BFAFAC2%5D._ipp._tcp.local/?uuid=1c852a4d-b800-1f08-abcd-308d99fafac2
network socket://192.168.7.235:9100
network ipp://envy4500.local:631/ipp/print

There are three device-uris for the printer. The ENVY 4500 has been discovered from the printer's Bonjour broadcasts using the dnssd://... backend. The snmp backend has also found the printer will accept jobs on port 9100 (socket://192...). Queues using either of these two device-uris would need to be set up with a PPD specified with the -m or -P option of lpadmin so would not be driverless. The URI for driverless printing is ipp://envy4500....

The device-uri for the printer can also be found with either of the ippfind or driverless utilities.

ippfind                         (Shows IPP printers and print queues).
ippfind -T 5                    (Possibly more reliable).
ippfind ! --txt printer-type    (Show IPP printers only).

driverless                  (To get the device-uri).
driverless list             (For the device-uri and printer metadata).
driverless device-uri       (Generate a PPD for the printer at device-uri).

A queue for driverless printing from a client is now set up with

lpadmin -p <print_queue_name> -v <device-uri> -E -m everywhere

The everywhere directive will cause the printer referred to by the -v option to be queried. A list of printer capabilities is returned and a PPD is automatically generated for use by command line programs and applications.

Creating a Driverless Print Queue with the CUPS Web Interface

Some familiarity with the CUPS web interface is assumed in this section.

  • Open the web interface and choose Administration. Select Add Printer and log in.

  • Your printer will be under the Discovered Network Printers:, probably with more than one entry. Choose the entry which contains the word driverless and move on to Continue.

  • Check that Connection is ipp://... and continue to the next page.

  • Model should have been be chosen for you and contain the word driverless. Add the print queue (a PPD is auto-generated) and set the default options for it on the next page.

Creating a Driverless Print Queue with system-config-printer

Some familiarity with system-config-printer is assumed in this section.

  • Start system-config-printer and choose Add followed by Network Printer.

  • An AirPrint or IPP Everywhere printer will probably be listed with a .local suffix.

  • Highlight the entry and check that the device URI begins ipp://... .

  • Moving on has system-config-printer searching for a driver, auto-generating a PPD and offering a screen to describe the printer. Choose Apply when done.

Creating a Driverless Print Queue with cups-browsed

This method leads to a fully automatic discovery of an AirPrint or IPP Everywhere printer, sets up a print queue and creates a PPD for it. The PPD is used to display printer options for command line programs and in applications. There are just two operations a user has to carry out.

  • Edit /etc/cups/cups-browsed.conf to set the CreateIPPPrinterQueues to all or driverless and restart cups-browsed.

CreateIPPPrinterQueues all
or
CreateIPPPrinterQueues driverless

systemctl restart cups-browsed
  • Check the existence of the queue and its options with

lpstat -t
and
lpoptions -p <queue_name> -l
  • The device-uri should begin ipp://.... The queue name is got from lpstat -t.

  • The queue persists provided the printer is switched on and cups-browsed is running.
  • With the CreateIPPPrinterQueues directive cups-browsed sets up a queue for a remote printer. With NewIPPPrinterQueuesShared Yes in /etc/cups/cups-browsed uncommented the printer is shared with other machines on the local network.

  • cups-browsed supports also a kind of legacy driverless printing. This means that some other common PDLs such as PostScript, PCL-XL, and PCL 5c/e are supported and also older IPP versions (1.x). Note that missing capability information can be replaced with default values and that implementations of these languages in the printers are often not reliable, so that, in contrast to official driverless printing, printing often does not work perfectly. Note that the PCL of HP inkjets does not work and therefore cups-browsed does not auto-create queues for this PDL.

CUPS and Driverless Printing: Miscellaneous

  • AirPrint and IPP Everywhere printers generally have a web interface for administration. It is accessed in a web browser with

http://<IP_address or host name of the printer>

The hostname can be obtained from the output of avahi-browse (see below). Make sure that IPP support and Bonjour broadcasting are enabled. The configuration options will probably be accessed under a Networking link and it could be that activating AirPrint is sufficient to activate both services.

  • A PPD auto-generated for a queue created by cups-browsed, the web interface and system-config-printer gives the highest priority to PDF, followed by PWG raster and then Apple raster. The priority sequence continues with PCL-XL, PostScript and finally PCL 5c/e. A PPD auto-generated for a queue created by lpadmin behaves slightly differently because it uses CUPS' PPD generator.

  • A text file sent to an AirPrint or IPP Everywhere printer would be filtered by CUPS and cups-filters to output an Apple or PWG raster file. If the printer has PDL support for MIME media type application/pdf a PDF would be sent instead. Typical possibilities for the filter chain are:

                                     ->|--------------------------------------------> Printer
text -> texttopdf -> pdftopdf -> PDF ->| gstoraster -> rastertopwg -> PWG raster ---> Printer
                                     ->| gstoraster -> rastertopwg -> Apple raster -> Printer

avahi-browse -art | less

Identify your Bonjour-advertised IPP printer and look for entries beginning URF=... and pdl=... . If URF=... exists and pdl=... contains image/urf you have an AirPrint printer.

For an HP Envy 4502:

URF=CP1,MT1-2-8-9-10-11,OB9,OFU0,PQ3-4-5,RS300-600,SRGB24,W8-16,DEVW8-16,DEVRGB24-48,ADOBERGB24-48,DM3,IS1,V1.3
pdl=application/vnd.hp-PCL,image/jpeg,application/PCLm,image/urf

For a Brother MFC-J650DW:

URF = SRGB24,W8,CP1,IS1,MT1-8-11,OB9,PQ4-5,RS300,OFU0,V1.2,DM3
pdl = application/octet-stream,application/vnd.brother-hbp,image/pwg-raster,image/urf,image/jpeg

The pdl contains an additional image/pwg-raster. This printer will accept and print PWG raster files. It could be an IPP Everywhere printer, but that all depends on whether it fulfills all the criteria necessary for the manufacturer to self-certify it with the Printer Working Group (PWG). However, it is possible the printer IPP implementation is sufficient for driverless printing to be used with CUPS.

  • The pdl=... line for the Envy 4502 above contains PCLm. This has nothing to do with PCL 5c/e and PCL-XL but is a streaming PDF protocol (Printer Control Lanaguage-Mobile). It is proprietary and undocumented. application/PCLm does not appear in an auto-generated PPD because it is not supported by CUPS.

  • Currently driverless printing with CUPS is network-only as it requires IPP for querying the capabilities from the printer so that the PPD can be generated. It also needs IPP to send option settings to the printer (as IPP attributes). More investigation and testing is needed on IPP over USB to make driverless printing also work via USB.

  • Driverless printing usually allows only adjustments on printing as they are thought out by the printer manufacturers. A printer driver like Gutenprint allows a lot fine tuning which goes far beyond a manufacturer's possibilities. This driver may suit photo enthusiasts more than a driverless solution.

  • Purchasing a printer with Apple raster and/or PWG raster capability means looking at the box containing the printer and printer brochures and manuals. AirPrint has been going for some time so it is usually fairly prominent as a feature in the literature. IPP Everywhere is much newer and may not be advertised. However, PWG raster could be on a GCP-enabled (GCP Ready) printer. If PDF is not a PDL for the printer it is obliged to have PWG raster. With PDF as a language it might have PWG raster as a fallback PDL.

Google Cloud Print (GCP) and CUPS

The conditions for setting up and using GCP with CUPS are

  • A Google account with print queues added to the account.
  • A connector between the cloud and the CUPS print queues.

We will be dealing in the remaining sections of this page with adding only CUPS print queues (not cloud-enabled printers) to the Google account.

A connector (or proxy) maintains a connection between GCP and the server running cupsd. A persistent XMPP channel is established over port 5222 or port 443 to talk.google.com. Messages over this channel can inform GCP about changes to the CUPS print queues and GCP can notify the server when there is a job submitted to it from a client. The job can then be downloaded and printed. Remember that this client can be anywhere in the world and must have the credentials to authenticate to the Google account or permission to use the printers it offers.

A user registers the print queue with GCP and claims the printer by providing a registration token from Google in an authenticated request to a specified URL via a browser. GCP responds with the credentials necessary for printing to take place. Added print queues can be shared by following the instructions here. On receiving notification of a pending job the connector downloads the document and submits it to the printing system.

  • Log into the Google account and go to the printer management page to display the queues known to GCP and print to a chosen queue by uploading a file to GCP.

Debian provides connectors with

Closing down a connector results in added queues becoming offline.

The Chromium Web Browser

From customize and control in Chromium's interface:

  • Settings.
  • Show advanced settings.
  • Google Cloud Print/Manage.
  • Classic printers/Add printers.
  • Select printers to register and add them to the account.
  • Manage your printers.

cloudprint

Install the cloudprint package and, as a user, do

cloudprint -d

to daemonise the service, or

cloudprint &

to have it run in the background, or

cloudprint

to watch all the its output on the screen.

You will be given a URL to go to and the program will output trying for the win while it waits for you to claim the print queues and complete their registration.

brian@desktop:~$ cloudprint
Go to https://goo.gl/printer/7hhnd to claim this printer
trying for the win
trying for the win
trying for the win`
Printer claimed by a_debian_user@gmail.com.
Polling for jobs on HP-ENVY-4500-series
Polling for jobs on LaserJet-300
Polling for jobs on DotMatrix
Establishing connection to xmpp server talk.google.com:5223
xmpp connection established
  • The file .cloudprintauth.json for account authententication credentials will be created in the home directory.

  • The default is to register all non-raw print queues known to CUPS for display in GCP.

Delete queues from the default set with

cloudprint -x HP -x Dot

Unlike google-cloud-print-connector, cloudprint does not recognise when the creation or deletion of a CUPS queue takes place on the server, so the event is not communicated to GCP. Include a newly created queue, wf2530, with

cloudprint -i wf -i HP -i Dot -i Las

or stop and restart the cloudprint service. The printer management page will have to be refreshed to see the new queue.

Automatic registration of selected queues when cloudprint is started can be accomplished from a .cloudprint.conf file in the home directory:

include = [Las, DotMatrixT]  # Excludes all other queues.
# exclude = [HP, Las]        # Includes all other queues.
  • cloudprint-service provides a systemd service file if the preferred way is to start on system boot and control cloudprint from the init system. Install it, execute

cps-auth

with root privileges and use the provided URL to claim the queues.

  • cloudprint logs to the journal in daemon mode (-d) or with a systemd service file on the system.

  • GCP will issue an error message (Could not convert to PDF.) when a text file does not have a .txt suffix.

  • Every file uploaded to GCP is converted by GCP to a PDF.

google-cloud-print-connector

Install google-cloud-print-connector. There are two programs, gcp-connector-util and gcp-cups-connector, in the package.

gcp-connector-util has options for the utility to create a configuration file, share a printer, delete all print queues associated with the particular connector instance and manage print jobs. See all options with

gcp-connector-util -h

To produce a configuration file, gcp-cups-connector.config.json, in the home directory do

gcp-connector-util init

and follow the instructions to claim the print queues.

Then start the connector in the foreground or background with

gcp-cups-connector
or
gcp-cups-connector &
  • The default is to include all non-raw print queues known to CUPS for display in GCP.
  • Logging by gcp-cups-connector is done to /tmp/cloud-print-connector.

  • gcp-cups-connector will notice when queues are added or deleted on the CUPS server and automatically update GCP with the new information. Refresh the printer management page to see an updated list of queues.

  • This wiki page describes parameters for configuring the connector.

  • GCP will issue an error message (Could not convert to PDF.) when a text file does not have a .txt suffix.

  • Not every file uploaded to GCP is converted by GCP to a PDF. PDF, PostScript, text and image files like jpg and png are submitted to CUPS exactly as they are sent.

Acknowledgements

Didier 'OdyX' Raboud <odyx@debian.org> for guiding and supporting CUPS 2.2.2, cups-filters and cups-browsed through the experimental archive and into unstable. Till Kamppeter <till.kamppeter@gmail.com> for his integration of cups-filters and cups-browsed with CUPS 2.2.2. Michael R. Sweet <msweet@apple.com> for developing the rastertopwg filter to support Apple raster.

See Also