Printlink

PrintLink

CI

Website: https://najm07.github.io/Printlink/

Peer-to-peer LAN printer sharing for small offices — no Windows printer sharing, no cloud, no accounts. Print from any PC to a printer attached to another PC on the LAN, with per-PC access grants that expire automatically.

How it works

Your document -> preview dialog (printer, copies, pages, paper, color,
                 duplex, orientation, fit)
   -> sender agent -> AES-GCM over HTTP :9100 -> host agent -> printer

No virtual printer and no port monitor: jobs are delivered directly between agents and handed to the physical printer by format:

Format Receiver handling
PDF PyMuPDF page-range subset + SumatraPDF (or printto)
Word (docx/doc) Word COM automation (copies, page range)
Excel/PPTX shell printto verb
PNG/JPEG/GIF/BMP/WEBP/TIFF/EMF GDI+ via PowerShell
Text spooler TEXT datatype

Jobs travel encrypted (AES-GCM keyed by the pairing token) directly PC-to-PC.

Repository layout

agent/         Python tray agent (all PCs)
installer/     Inno Setup script (agent-only install)
docs/          architecture.md, protocol.md, security.md, debugging-notes.md
tests/         pytest suite

agent/pipe_reader.py is legacy code from the retired port monitor: it is not used by the shipping product. It only activates if the agent is started with LEGACY_PIPE_ENV=1 (see main.py); kept for anyone still running an old port monitor.

Development setup

python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r agent/requirements.txt
python agent/main.py

Requires Windows for real use (pywin32, spooler/COM/GDI+ printing). The share/identity logic and HTTP API are platform-independent and covered by tests that run on any OS.

Testing

python -m pytest tests/

Building the installer

  1. Bundle the agent:

    python -m PyInstaller --noconfirm PrintLinkAgent.spec
    

    Produces dist\PrintLinkAgent.exe (onefile, windowed, ~52 MB; the spec pins the excludes so the build stays fast and small).

  2. Build the installer:

    & "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" installer\printlink.iss
    

    Produces installer\output\PrintLinkSetup-<version>.exe.

The installer registers the tray agent at login, opens firewall rules for TCP 9100 (API) and UDP 5353 (mDNS) on the Private profile, and calls the agent’s --install-verbs to add the right-click verb. On domain networks the firewall rules are per-PC; adjust via GPO.

Since 0.2.3, agent data (printers, grants, tokens, identity) is shared machine-wide in %PROGRAMDATA%\PrintLink so every user account on a PC sees the same printers. This makes tokens readable by any local user — see docs/security.md for the threat model and planned hardening.

Security model

See docs/protocol.md for wire formats, docs/architecture.md for design, and docs/security.md for the threat model.

Licensing

PrintLink itself is MIT-licensed (see LICENSE). The preview thumbnails and PDF page-range rendering use PyMuPDF, which is AGPL-3.0 / commercial dual license. Anyone redistributing PrintLink commercially must swap in pypdfium2 or drop the preview (the receiver falls back to printing the whole file). Pillow (thumbnails) and PyInstaller (bundling) are similarly bundled under their respective licenses.