Skip to content

Printer daemon that checks emails, and physically prints specific filtered email from a mailbox. Implementation and usage for printing hold slips in school library context. More details on README.md.

License

Notifications You must be signed in to change notification settings

RonBulaon/HoldSlipPrinter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HoldSlipPrinter

Alma is a cloud solution for libraries. And because this service is hosted on the cloud, it does not have access to local printers attached on the devices where it is accessed. The common solution and workaround is to use Thunderbird as a print proxy for printing Hold Slips. In this regard, HoldSlipPrinter aims to even simplify printing hold slips by removing the graphical interface and just run this script as a print daemon in the background.

Advantages

  1. There is no graphical interface i.e. Less distraction and less point of error.
  2. Configuration/Settings are located in a single configuration file.
  3. Print output is smaller than my Thunderbird work around.

Here's a simplified things that this solution will do:

  1. Check for new emails with hold request notification.
  2. If there's a new email, download and save it for printing at request folder.
  3. Then send the saved requests (in PDF) to the printer.
  4. If printing is successful move the file from request folder to printed folder.
  5. Repeat the entire process.

How to use this:

You have two options to choose from:

  1. Easy way : Download and configure the binaries from compiled directory.
  2. Compile a copy : Clone this repository and compile your own version.

Easy Way:

These instructions does not cover installation of your printer. This app will send files to the default printer set on the operating system level. This will work with any printer you set as default. I'm using EPSON TM-T82

  1. Download the compiled version of holdslipprinter.zip and extract contents.

  2. Edit in your settings at the configuration file holdslipprinter.ini.

    [DEFAULT]
    mylocation = Library Name
    email = your_email@domain.edu.sg
    username = DOMAIN\userid
    password = secure_password
    
    [MAIL]
    subject = Resource Request Slip
    from = sender@domain.edu.sg
    
    [MISC]
    count = 20
    
    [LOG]
    folder = logs
    retention = 2
    

    holdslipprinter.ini must be in the same directory as app.exe. Fill and change values as needed:

    • mylocation - In my case we have multiple location and we only wanted to print for the location where the printer is located. This entry must be searchable within the body of the email.
    • email - email address for the mailbox where you receive the hold slip requests
    • username - login account for the mailbox. The same account you used for checking this mailbox.
    • password - password for the mailbox. This should be the same password you use to access the email.
    • subject - subject of the email of the hold requests
    • from - email address of the sender of the hold request i.e. the email alma used for sending the hold request.
    • count - number of emails to be check. Example if you put 20, the 1st 20 emails will be checked.
    • folder - folder name of the log file destination
    • retention - number of days to keep the log files.
  3. Open Windows' Task Scheduler, create and configure a basic task to run app.exe at each computer startup. Here's the settings I've used for your reference. This part may differ depending on PC setup/environment. The goal here is to ensure that the application is always running.

    • General Tab
      General
    • Triggers Tab
      Triggers
    • Actions Tab
      Actions
  4. On the printer settings, set the printer to keep printed documents. This will prevent the printer to print multiple copies of the slips. Here's how I set mine:

    • Advance Tab of printer settings
      printer settings
  5. This step is optional but recommended to run these scripts at least once a day.

    • deletePrintedPDF.bat will delete the printed PDFs at printed folder. If you want to archive all the printed files, then you do not have to run this script. You can go to the printed folder too to re-print any previously printed slips.
    • restartSpooler.bat This script will clear all the printed logs at the printer's print queue. If you have low volume of printouts you can schedule this to once a week. Mine is on daily.

    Here's how I set mine:

    • General Tab
      General
    • Triggers Tab
      Triggers
    • Actions Tab
      Actions

    Note : I did these settings for both scripts and the scripts assumes that the folders' location is at Program Files.

  6. Install the latest Visual C++ Redistributable Packages.

Compile a copy:

Before compiling your own version follow the Easy Way instructions above. Then do the following:

  1. Clone this repository.

    git clone https://github.com/RonBulaon/HoldSlipPrinter.git
    
  2. Go to the downloaded repository's source folder and install the requirements.

    cd source
    
    pip install -r Requirements.txt
    
  3. Compile to an executable.

    pyinstaller --noconsole --nowindowed -F app.py
    
  4. PyInstaller will create a dist folder and you should be able to find app.exe inside. Copy app.exe and replace the file app.exe file you have from holdslipprinter.zip.

Sample Output

Below are sample printouts from (left) Thunderbird and (right) HoldSlipPrinter.
Sample

Acknowledgements :

I have used WKTOPDF to convert HTML files to PDF. Check their github page here. For sending files to printer I've used PDFtoPRinter. This program will send PDFs to printer from a windows command line.

Click here to check out the Exlibris developer network blog entry.

Other Ideas:

  • What about a version of this on a headless single board PCs?

Copyright

Copyright (c) 2020 Ron Bulaon
Licensed under the MIT License(MIT). See LICENSE.md for more info.

About

Printer daemon that checks emails, and physically prints specific filtered email from a mailbox. Implementation and usage for printing hold slips in school library context. More details on README.md.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published