centos6google-cloud-print

CUPS-cloud-print CentOS


I am trying to print to a printer shared for a google cloud print account. I am trying to use CUPS-Cloud-Print, which lets you add printers from your cloud print account to your local CUPS server. The problem with this one is that my print gets an error. So if anyone has used CUPS-Cloud-Print recently on a CentOS/RedHat based system and gotten it to work, that would also be helpful.

As per the issue I posted on this project, I can save a document to the google drive, just cannot print. So I know the authentication is working. I can also print to this same printer via various browsers ( even browsers on the CentOS machine in question ), so the problem is not the printer or the printer's network, or the setup of the printer in Google Cloud Print. Maybe there is a way to enable more verbose logging to figure out the true problem ( like maybe it cannot convert it to PDF ). The error I get is "Error response from Cloud Print for type pdf: Failed to parse the print job's print ticket."

More info: I went to the simulation page here, using the same ticket from my cups logs ( see below ). This simulation page requires a PDF ( CUPS-Cloud-Print does the conversion for me ), so I provided a real PDF. The first time, I tried it with the ticket below and got the same error CUPS-Cloud-Print got. The second time, I left the ticket in the simulator as is, and it printed fine.

Ticket from CUPS logs that Cloud Print seems to be having a problem with, whether I use CUPS-Cloud-Print or simulation tool:

{"print": {"color": {"type": "STANDARD_COLOR"}, "margins": {"type": "STANDARD"}, "dpi": {"vendor_id": "epns200:Level2", "vertical_dpi": 360, "horizontal_dpi": 360}}, "version": "1.0"}

More information gleaned from simulator:

This ticket works:

{
    "print":
    {
        "color":
        {
            "type": "STANDARD_COLOR"
        },
        "dpi":
        {
            "vendor_id": "epns200:Level2",
            "vertical_dpi": 360,
            "horizontal_dpi": 360
        }
    },
    "version": "1.0"
}

And this ticket does NOT work:

{
    "print":
    {
        "color":
        {
            "type": "STANDARD_COLOR"
        },
        "margins":
        {
            "type": "STANDARD"
        }
    },
    "version": "1.0"
}

So it seems to be the margins that are wrong, but I see nothing wrong with that. But I see nothing wrong when I compare it to the Google docs here. Any ideas?


Solution

  • It turns out that issue #114 solved my problem. Basically, I had to change /usr/share/cloudprint-cups/printer.py method _getCapabilities from

        return self._getCapabilitiesDict(attrArray,
                                         self['capabilities']['printer'],
                                         overridecapabilities)
    

    to

            # HACK HERE
            #return self._getCapabilitiesDict(attrArray,
            result = self._getCapabilitiesDict(attrArray,
                                     self['capabilities']['printer'],
                                     overridecapabilities)
            result['print'].pop('margins', None)
            #result['print']['duplex']['type'] = 'LONG_EDGE'
            return result
    

    The key for me was removing/popping the margins from the Google Print Ticket, since that was what was causing the Google to reject the Google Print Ticket. For whatever reason, the duplex line caused something to crash, which is why it is commented out.