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.
- There is no graphical interface i.e. Less distraction and less point of error.
- Configuration/Settings are located in a single configuration file.
- Print output is smaller than my Thunderbird work around.
- Check for new emails with hold request notification.
- If there's a new email, download and save it for printing at request folder.
- Then send the saved requests (in PDF) to the printer.
- If printing is successful move the file from request folder to printed folder.
- Repeat the entire process.
You have two options to choose from:
- Easy way : Download and configure the compiled versions on compiled directory.
- Compile a copy : Clone this repository and compile your own version.
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
-
Download the compiled version of holdslipprinter.zip and extract contents.
-
Edit in your settings at the configuration file holdslipprinter.ini.
[DEFAULT] mylocation = Li Ka Shing Library 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.
-
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.
-
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:
-
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:
Note : I did these settings for both scripts and the scripts assumes that the folders' location is at Program Files.
-
Install the latest Visual C++ Redistributable Packages.
Before compiling your own version follow the Easy Way instructions above. Then do the following:
-
Clone this repository.
git clone https://github.com/smu-libraries/HoldSlipPrinter.git
-
Go to the downloaded repository's source folder and install the requirements.
cd source
pip install -r Requirements.txt
-
Compile to an executable.
pyinstaller --noconsole --nowindowed -F app.py
-
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.
Below are sample printouts from (left) Thunderbird and (right) HoldSlipPrinter.
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.
What about a version of this on a headless single board PCs?
Copyright (c) 2020 Ron Bulaon
Licensed under the MIT License(MIT). See LICENSE.md for more info.