How thyrlian/airpdfprinter works
Project type and purpose
• This is a containerized, single‐service application whose sole function is to expose a virtual PDF printer via AirPrint (IPP + mDNS).
• The Docker image packages and runs CUPS (with CUPS-PDF backend) and Avahi daemon for Bonjour broadcasting.
File structure
• Top level:
• Dockerfile – builds the container image
• config.sh – initialization script
• cupsd.conf – custom CUPS configuration
• AirPrint-PDF.service – Avahi service definition for mDNS
• assets/ – documentation screenshots
• No “frontend” or “backend” directories: this is a single‐service (print server) container.
• Volumes are mapped at runtime:
• $(pwd)/pdf → /root/PDF (output directory)
• $(pwd)/cups-pdf → /var/spool/cups-pdf (print spool)
README for additional insights
• The container uses host networking (--network=host) so that:
• TCP port 631 (IPP) is bound to host’s CUPS port.
• UDP port 5353 (mDNS) is served by Avahi.
• DBus is required on the host for Avahi; not inside container.
• Dependencies: CUPS, cups-pdf, avahi-daemon, system init scripts.
Main components and interactions
a. Host environment
• Docker Engine
• systemd/dbus (for Avahi to fire on host)
b. Container
• CUPS print server (cupsd)
• CUPS-PDF backend (writes PDF output)
• Avahi daemon (reads AirPrint-PDF.service, broadcasts mDNS on 5353)
• config.sh entrypoint (starts services)
c. Runtime volumes
• PDF output directory
• CUPS-PDF spool directory
d. Clients
• iOS/macOS devices that discover the printer via mDNS and send IPP print jobs.
Architectural patterns & design principles
• Single responsibility: one container, one service.
• Host networking: everything binds directly to host stack—no Docker port mapping needed.
• Data persistence via host‐volume mapping.