A lightweight Docker-based PDF printing utility designed to print PDF documents from Linux systems without installing CUPS or printer drivers on the host.
The current implementation targets the Samsung Xpress M2026 / M2020 Series, but the long-term goal is to support multiple printer models through interchangeable drivers and configuration profiles.
Planned improvements include:
- Support for additional printer models.
- Configurable printer profiles.
- Automatic driver selection.
- Network (IPP/JetDirect) printers.
- Multiple paper sizes and media types.
- Support for printing non-PDF file formats (e.g., images, text, and office documents).
- Simple command-line interface.
- No CUPS installation required on the host.
- No printer drivers installed on the host.
- USB printer support.
- Automatic printer detection.
- Automatic printer configuration.
- PDF printing from any mounted directory.
- Configurable paper size (currently A4 and A5).
Host requirements:
- Docker
- Linux
- A supported USB printer
Verify that the printer is visible:
lsusbExample:
Bus 001 Device 010: ID 04e8:3321 Samsung Electronics Co., Ltd M2020 Series
.
├── Dockerfile
├── print.sh
└── README.md
docker build -t samsung-m2026-print .The basic syntax is:
docker run --rm \
--privileged \
-v "$PWD:/work" \
samsung-m2026-print \
/work/file.pdf [PAGE_SIZE]The second argument is optional.
If omitted, A4 is used.
Examples:
Print on A4:
docker run --rm \
--privileged \
-v "$PWD:/work" \
samsung-m2026-print \
/work/document.pdfor explicitly:
docker run --rm \
--privileged \
-v "$PWD:/work" \
samsung-m2026-print \
/work/document.pdf A4Print on A5:
docker run --rm \
--privileged \
-v "$PWD:/work" \
samsung-m2026-print \
/work/menu.pdf A5Current implementation:
| Argument | CUPS option |
|---|---|
| A4 | PageSize=A4 |
| A5 | PageSize=A5 |
Additional paper sizes can easily be added by extending print.sh and rebuilding.
Whenever Dockerfile or print.sh changes:
docker build -t samsung-m2026-print .Open an interactive shell:
docker run --rm -it \
--privileged \
--entrypoint bash \
-v "$PWD:/work" \
samsung-m2026-printStart CUPS:
service cups startAvailable USB devices:
lsusbPrinter URI:
lpinfo -vInstalled printer drivers:
lpinfo -m | grep splixPrinter capabilities:
lpoptions -p Samsung_M2026 -lAfter submitting a print job, CUPS returns immediately, but the printer backend may still be transferring data to the USB device.
If the container exits too quickly, the USB backend may terminate before the printer has completely received the job. On some printers this results in behavior where the printer starts, makes its usual initialization noise, and then stops without feeding paper. Running the same command a second time often succeeds because the printer is already awake.
To avoid this race condition, the script waits for the print queue to finish and then deliberately keeps the container alive for an additional 10 seconds before exiting. This ensures the USB transfer has enough time to complete reliably.
The delay is not strictly required by CUPS itself; it is a practical reliability measure for short-lived containers.
This project currently uses:
- Debian Bookworm
- CUPS
- Ghostscript
- SpliX printer drivers
The Samsung M2026 does not understand PDF directly.
The container automatically converts PDF documents into the printer language required by the device before sending them over USB.
No printer software is installed on the host.
- USB printers only.
- Currently tested with Samsung Xpress M2026 / M2020 Series.
- Requires Docker
--privilegedto access USB devices.
This project is licensed under the GNU General Public License v3.0 (GPLv3).