This application provides a way for a user to send a predefined PDF to a predefined printer, using OTP (One-Time Password) generation and verification. One use of this application is to send a predefined signature to a printer, allowing the user to effectively "sign checks" by printing the signature over the top of printed checks.
It is built using Flask and includes logging for important events.
- Python 3.11+
- pip (Python package installer)
- Virtual environment (optional but recommended)
- PDF to Printer (or any other PDF to Printer software)
-
Clone the repository:
git clone https://github.com/jcarter62/doc-signer.git cd <repository-directory>
-
Create and activate a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Set up environment variables:
Create a
.env
file in the root directory of the project and add the following variables:PRINTER_EXE=c:\...\PDFtoPrinter.exe PRINTER1=hpprinter NAME=Jim User EMAIL=jcarter62@gmail.com PDFFILE=c:\temp\one-page.pdf OTP_FILE=c:\temp\otp.txt EMAIL_SERVER=192.168.1.100 EMAIL_PORT=25 EMAIL_FROM=user@go.com HOST=0.0.0.0 PORT=5000
-
Static Files:
Ensure that the image files are placed in the
static
directory. For example,pen-writing-on-check.png
should be located atstatic/pen-writing-on-check.png
. -
Templates:
The HTML templates are located in the
templates
directory. You can customizehome.html
andsuccess.html
as needed.
-
Start the application using
run.py
:python run.py
This will start the server with logging configured in
run.py
.
Logging is configured in run.py
to log important events and errors to the console. You can view the logs in the terminal where you start the application.
-
Generate OTP:
Navigate to the home page and click on "Generate New OTP Code". The OTP will be sent to your email.
-
Verify OTP:
Enter the OTP code received in your email and click "Verify OTP Code".
-
Print Signature:
After OTP verification, enter the quantity of signatures to print and click "Print".