Sign inSign up

jacklugano/pdf-printer

By jacklugano

•Updated over 3 years ago

stampa i pdf da un gruppo google a una stampate di rete hp

Image
0

10K+

jacklugano/pdf-printer repository overview

⁠Readme for script that prints attachments from Gmail

This script downloads PDF attachments from unread emails in Gmail that have the label "stampa", prints them to a printer and changes the label to "stampata" (meaning "printed" in Italian). The script runs continuously and checks for new emails every minute.

⁠Requirements

This script requires Python 3 and the following Python packages:

  • os
  • base64
  • sys
  • pickle
  • logging
  • time
  • cups
  • json
  • google-auth
  • google-auth-oauthlib
  • google-auth-httplib2
  • google-api-python-client

The script also requires a credentials.json file containing the Google API credentials for the Gmail account that will be accessed, and a printer that can receive data via port 9100.

⁠Installation

To install the required packages, run:

pip install -r requirements.txt

where requirements.txt is a file containing the names of the required packages.

⁠Usage

To use this script:

  1. Ensure that the printer is set up and connected to the network.
  2. Obtain Google API credentials for the Gmail account that will be accessed and save them in a file called credentials.json.
  3. Modify the PRINTER_IP variable in the script to match the IP address of the printer.
  4. Run the script using the command:
python print_email_attachments.py

The script will continuously check for new unread emails with attachments and the label "stampa", download any PDF attachments, print them to the specified printer, and change the label to "stampata". The script will repeat this process every minute until interrupted.

⁠Logging

The script logs its activity to a file called log_file.log in the same directory as the script. The log file contains information about the script's activity, including any errors that occurred during execution.

⁠License

This script is licensed under the MIT License⁠.

Tag summary

Content type

Image

Digest

sha256:d4e137cd6…

Size

210.2 MB

Last updated

over 3 years ago

docker pull jacklugano/pdf-printer