Fixing Chrome Color Printing on Linux with HP Color LaserJet M880

It seems like I can't get a printer that "just works". I recently decided to replace our HP X476 printer with something nicer and bigger, an HP Color LaserJet M880 (background story & review in German). And of course there is something that needs fixing:

The Chrome browser on Linux wouldn't let us print in color, even though all other applications had no problem to print in color. Even with Chrome color printing was possible, if one used the system printing dialog instead of the built-in Chrome print preview.

This strange behavior of course piqued my curiosity. After some digging around I found out that the Chrome browser needs to parse and understand the printer driver PPD! Chrome tries to find out how to configure color or grayscale printing in order to offer the user the choice. If Chrome can't understand the printer driver then it simply doesn't offer the choice between color and grayscale — and then some printer driver default can choose to print in grayscale instead of color.

Fixing color printing support in Chrome on Linux for HP M880, solves Chrome Bug 1035009 for the HP Color LaserJet flow MFP M880 printer. The effect of this printer driver is that the Chrome browser shows the Color/Black and White toggle in the print preview:

browser preview

With the original printer driver the Chrome browser (and potentially all Chromium based browsers) on Linux cannot print in color, only in grayscale. While one can use the system printing dialog as a workaround, it is inconvenient to do so and the system printing dialog doesn't show a preview of the printout as the browser printing dialog.

The root cause are hard coded strings in the Chrome printing stack that match only for some HP printer drivers, while other HP printer drivers simply use other strings for the same thing. Chrome wants to offer the user a simplified configuration for printing, but for that Chrome needs to parse and understand all printer drivers. Sadly the printer drivers on Linux don't follow any standard in their internal structure, so that the Chrome developers had to add a lot of code to deal with the printer drivers of all the printer vendors.

My pacthed PPD file found at github.com/schlomo/HP-Color-LaserJet-flow-MFP-M880 solves the problem because it simply uses the names for color and grayscale that Chrome already supports:


As a result the printer configuration user interface also changes, which I consider an improvement as it makes the setting more explicit and simpler to understand:

Original Print Driver

original

Fixed Print Driver

fixed

Comments

Like this content? You could send me something from my Amazon Wishlist. Need commercial support? Contact me for Consulting Services.

Popular posts from this blog

Overriding / Patching Linux System Serial Number

A Login Security Architecture Without Passwords