Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# Install Flask
@rbpzprint:~/PrintApp sudo apt update && sudo apt install python3-flask -y

# Controle beschikbare printers
@rbpzprint:~/PrintApp lpstat -v
device for Xerox_WC_6505DN: usb://Xerox/WorkCentre%206505DN?serial=3163780819&interface=1

# Set printer as DEFAULT
pi@rbpzprint:~/PrintApp $ sudo lpadmin -d Xerox_WC_6505DN

# Check Default printer
pi@rbpzprint:~/PrintApp $ lpstat -d
system default destination: Xerox_WC_6505DN

# to debug start python app locally
pi@rbpzprint:~/PrintApp $ python app.py 
 * Serving Flask app 'app'
 * Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:5000
 * Running on http://192.168.3.22:5000
Press CTRL+C to quit
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 542-000-292
192.168.4.8 - - [27/May/2026 00:29:21] "GET / HTTP/1.1" 200 -
192.168.4.8 - - [27/May/2026 00:29:21] "GET /favicon.ico HTTP/1.1" 404 -
192.168.4.8 - - [27/May/2026 00:29:44] "GET / HTTP/1.1" 200 -
 * Detected change in '/home/pi/PrintApp/app.py', reloading
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 542-000-292

Om PDF-pagina's te kunnen tellen, installeren we de lichte bibliotheek pypdf:
sudo apt update && sudo apt install python3-pypdf -y

# Automatisch opstarten bij boot (Service instellen)
#   We maken een Linux systemd service aan die ervoor zorgt dat de server onzichtbaar opstart zodra de Pi stroom krijgt,
#   en herstart als hij onverhoopt crasht.
sudo nano /etc/systemd/system/printapp.service
[Unit]
Description=Xerox Web Print Server
After=network.target cups.service

[Service]
Type=simple
User=pi
WorkingDirectory=/home/pi/PrintApp
ExecStart=/usr/bin/python3 /home/pi/PrintApp/app.py
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

# Activeer en start de nieuwe service met deze commando's:
sudo systemctl daemon-reload
sudo systemctl enable printapp.service
sudo systemctl start printapp.service

# Service herstarten na aanpassingen
sudo systemctl restart printapp.service

# *** Hieronder enkel indien je ook Word Doc en Docx files wil afdrukken ***
# LibreOffice installeren op de Pi
sudo apt update && sudo apt install libreoffice-writer --no-install-recommends -y

# extra fonts installeren om docx naar PDF te renderen
sudo apt update
sudo apt install ttf-mscorefonts-installer

About

Web interface to print to local CUPS default printer

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages