Pergunta

I don't know if it's possible or practical yet, but if it is: How can one print to a printer using Google Cloud Print from a python application running on Google App Engine?

For the purposes of an example, let's presume the user is logged into a Google or Google Apps account when accessing the App Engine application, and that account is attached to a cloud-aware printer (e.g. registered printers in Google Chrome with cloud print).

I'd like to print, for example, a PDF file that's stored in a blob on GAE. Let's call this blob pdf_contents. I'd like a function:

def print_pdf(pdf_contents, printer, print_settings):
    """Prints `pdf_contents` (a blob conforming to the PDF standard) to `printer`
     (a Google Cloud Printer) with the given `print_settings`"""
    # what goes here?

I'd like to know how to go about doing this, and whether anyone else has made any efforts in this respect. Of course, I don't want to limit the printing to PDF files, but wanted to narrow down the example.

Thank you for reading.

Foi útil?

Solução

According to the API FAQ, it's not out yet, but when it is, you should be able to print from an App Engine app or any other app:

Will non-Google products be able to use Google Cloud Print?

Yes, we will offer an API for any app to use Google Cloud Print

Outras dicas

Google Cloud Print is not currently a general purpose printing service. From the page you linked in your question:

Where can I print from?

We’re working hard to provide Google Cloud Print integration with many Google products and services, the first of which are Chrome OS, Gmail for mobile, and Google Docs for mobile.

So only Chrome OS devices (netbooks) and Gmail/Docs for mobile can use cloud print at this time.

I wrote cloudprinting to simplify using Google Cloud Print with Python.

Here's an example:

from cloudprinting import ClientLoginAuth, submit_job
auth = ClientLoginAuth("username@gmail.com", "password")
submit_job(printer="...", content=("blob.pdf", pdf_contents), auth=auth)

Google has deprecated the client login auth, so you should use OAuth2 instead.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top