Skip to main content

a4_printer_webserver

A single-printer web interface built with Flask and native WebSockets. It uses a4-printer-interface to discover the printer, monitor its activity, and submit PDF documents or images.

Installation

Python 3.10 or newer is required. The target printer must already be configured in the operating system.

python -m pip install a4_printer_webserver

First, list the available printers and their UUIDs:

python -m a4_printer_interface

Then start the website:

python -m a4_printer_webserver `
  --uuid "printer uuid" `
  --password "your password"

The server listens on http://127.0.0.1:5000 by default, and the default page title is Printer Website. To use a custom title:

python -m a4_printer_webserver `
  --uuid "8fd0d51f-12c8-5b50-a2f1-4f64641ae77c" `
  --password "your password" `
  --title "New Title"

Both --uuid and --password are required. An empty password is rejected. The following options are also available:

  • --host 127.0.0.1: Address on which the server listens. Use 0.0.0.0 to allow access from the local network.
  • --port 5000: TCP port on which the server listens.
  • --data-dir printer_data: Directory for uploaded files, the SQLite queue, and print history.
  • --max-upload-mb 100: Maximum size of one uploaded file, in MiB.
  • --auto-delete DAYS: Automatically delete submitted document files after a positive number of days. Automatic deletion is disabled when this option is omitted.

When exposing the service to a local network or the internet, place it behind an HTTPS-enabled reverse proxy. Passwords and documents should not cross an untrusted network over plain HTTP.

Behavior

  • Unauthenticated users can only access the login page. They cannot view the queue, download previously submitted files, or establish an authenticated WebSocket connection.
  • Uploading a document does not print it immediately. The user must click Print before the document enters the queue.
  • In Ready and History, Preview opens a saved PDF in a new tab. The action is unavailable for deleted files and non-PDF jobs.
  • Print color test page and Print black-and-white test page ask for confirmation before queuing the built-in PDF in the selected mode. The queue shows the mode, and the job can be canceled until printing starts.
  • Pause printing prevents queued jobs from starting. It does not interrupt a job that is already printing, and the paused state resets when the server restarts.
  • Documents that have not started printing can be canceled. A document in the printing state cannot be canceled.
  • After the printing library returns successfully, the job is shown as Submitted. This means that the operating system accepted the job; it does not guarantee that the physical pages have finished printing.
  • A green light means the printer is idle, yellow means the printer or the current submission is busy, and red means that the configured UUID cannot be found or the print service status cannot be read.
  • While the printer reports that it is busy, the most recently submitted job remains in History but is displayed as Printing. It returns to Submitted when the printer becomes idle.
  • A submitted document can be deleted manually after confirmation. Manual and automatic deletion remove only the stored file; the History entry remains. Its Download button is then shown as disabled. Files for jobs currently shown as Printing, and built-in test-page jobs, do not offer a Delete button.
  • The queue and history are stored in SQLite. If the server stops unexpectedly, a job that was being submitted is marked as failed and is not printed again automatically.

Tests

python -m unittest discover -s tests -v

Metadata

Release files for a4-printer-webserver 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for a4-printer-webserver 0.1.6
File Size Uploaded Provenance Actions
a4_printer_webserver-0.1.6.tar.gz 32.3 kB Without provenance Details for a4_printer_webserver-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for a4-printer-webserver 0.1.6
File Interpreter ABI Platform Actions
a4_printer_webserver-0.1.6-py3-none-any.whl Python 3 none any Details for a4_printer_webserver-0.1.6-py3-none-any.whl

Total release size: 61.4 kB

Release files / a4_printer_webserver-0.1.6.tar.gz

Download URL a4_printer_webserver-0.1.6.tar.gz
Size 32.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e9fb2f4d36adc49c29e6252b1ce60b121c889bc5670282c55bf9589afcef29e4
BLAKE2b-256 checksum
How to use checksums
6ecadda117f8ba14348b7c37eccb5235b389d275a91de8f169a3658dd1191594
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.6 Windows/11

Release files / a4_printer_webserver-0.1.6-py3-none-any.whl

Download URL a4_printer_webserver-0.1.6-py3-none-any.whl
Size 29.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17133560f5b70c21d51c4395cbf8d7deaadd203b308e7563aef1933523e3f991
BLAKE2b-256 checksum
How to use checksums
e4740839475fd8b5bdfce380d4a1f6de603f12d080cabd3fc650abffb1dabaf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.6 Windows/11

Security for a4-printer-webserver 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page