This script is a post processor for CUPS-PDF that adds a visible timestamp to the created document.
It was developed to allow adding documents to a document management system by printing them, while also receiving a hardcooy with an date of receipt stamp..
- Install CUPS-PDF
- clone repository to
/opt/cups-timestamp
- install dependencies
- by installing the dependencies system wide:
- Debian-ish:
apt install python3-reportlab python3-pypdf2 python3-cups
- Debian-ish:
- or by creating a
venv
and installing the usingpip
:cd /opt/cups-timestamp
python3 -m venv venv
venv/bin/pip install -r requirements.txt
- change the shebang to the python binary inside your venv
- by installing the dependencies system wide:
- copy
/etc/cups/cups-pdf.conf
to/etc/cups/cups-pdf-timestamp.conf
(or any other name that matchescups-pdf-*.conf
) - add the location of
process.py
as value ofPostProcessing
in the conf file - add a new printer to your cups instance, choose
cups-pdf:/timestamp
as connection URI (the web interface should offer you to configure CUPS-PDF (Virtual timestamp Printer))- as driver select Generic → Generic CUPS-PDF Printer (no options)
You can add multiple variants of this script by renaming the timestamp part of the conf filegit name and in the connection URI. (This is a CUPS-PDF feature.)
You probably want to change some of the variables at the top of process.py
, e.g the location to put stamped PDFs into or the printer to print them with. You may want to change the locale setting at the top (or comment it to use the user’s locale settings).
The text of the timestamp can be changed by modifying create_stamp()
, please consider the documentation for reportlab on how to do that.