A Linux installer script that creates virtual CUPS printer queues for automatic booklet imposition and duplex printing.
Booklet PrintQueue simplifies booklet printing by creating virtual CUPS printers that automatically:
- Reorder pages for saddle-stitch (fold-in-the-middle) binding
- Impose pages into a 2-up landscape layout (two input pages side-by-side on one output page)
- Force duplex printing with short-edge binding orientation
- Pad pages automatically to multiples of 4 as required for booklet layout
Simply print to the Booklet-<PrinterName> queue instead of your regular printer, and the output is ready to fold and bind.
- Select a virtual
Booklet-PrinterNamequeue from your print dialog - Use any native printer options (color mode, paper tray, quality, etc.) — these are inherited from the real printer
- Click print
- Your document is automatically converted (if needed), reordered, and imposed for booklet binding, then sent to the physical printer with duplex short-edge selected
The installer creates a two-stage CUPS pipeline:
-
CUPS Filter (
cups-booklet-filter): A Python script that performs booklet imposition using pypdf- Pads pages to a multiple of 4
- Reorders pages for saddle-stitch binding
- Outputs a 2-up landscape PDF
-
CUPS Backend (
booklet): A custom backend that forwards the imposed PDF to the real printer- Forces
sides=two-sided-short-edgefor proper duplex binding orientation - Encapsulates the real printer's URI for transparent operation
- Forces
-
Virtual Queues: One per selected printer, using the real printer's PPD (when available) to preserve native driver options
- Linux: Debian/Ubuntu (apt-based distributions)
- CUPS: Print server (typically pre-installed on desktop environments)
- Python 3: Scripting runtime (typically pre-installed)
- pypdf: Python library for PDF manipulation (installed automatically via apt or pip3)
download install-booklet-printqueue.sh from this repository
chmod +x install-booklet-printqueue.sh
sudo ./install-booklet-printqueue.sh- Checks for required dependencies (CUPS, Python 3, pypdf)
- Auto-detects existing CUPS printers and presents a numbered menu for selection
- Alternatively, accepts manual printer URIs (e.g.,
ipp://hostname/printers/PrinterName) - Creates virtual
Booklet-<PrinterName>queues for each selected printer - Stores configuration in
/etc/booklet-printers.conffor future reference and editing
- Open any print dialog (browser, PDF viewer, office suite, etc.)
- Select a
Booklet-<PrinterName>queue - Configure any printer-specific options (color, tray, quality)
- Click print
The document is automatically reordered and imposed; no additional steps required.
To verify the booklet imposition without printing:
/usr/lib/cups/filter/cups-booklet-filter input.pdf > booklet.pdfThis outputs the imposed PDF to booklet.pdf.
Edit the configuration file:
sudo nano /etc/booklet-printers.confAdd or remove printer URIs (one per line), then re-run the installer:
sudo ./install-booklet-printqueue.shThe installer will update the virtual queues to match the new configuration.
If auto-detection doesn't find your printer, you can add it manually using its URI:
- USB printer:
usb://Manufacturer/Model - Network printer (IPP):
ipp://hostname/printers/QueueName - Network printer (LPD):
lpd://hostname/QueueName
To remove all virtual booklet queues and restore the original CUPS configuration:
sudo ./install-booklet-printqueue.sh --removeThis removes:
- Virtual printer queues
- CUPS filter and backend files
- Configuration file (
/etc/booklet-printers.conf)
- The booklet filter is installed per-queue via the
*cupsFilterPPD directive; no global CUPS configuration is modified - Each virtual queue inherits the real printer's PPD (or falls back to a generic PPD), preserving native driver options
- This design allows multiple filter types to coexist without conflicts
- The custom
bookletbackend receives the imposed PDF from the filter and forwards it to the real printer - The backend forces
sides=two-sided-short-edgeunconditionally, ensuring correct binding orientation regardless of print dialog settings - The real printer's URI is embedded in each virtual queue's configuration
- pypdf (~1 MB) is used for imposition
- Only Python 3 (typically pre-installed on Linux systems) is required as a runtime dependency
Important: CUPS is gradually deprecating PPD (PostScript Printer Description) files in favor of IPP (Internet Printing Protocol). This tool relies on PPD-based configuration. While PPD support remains stable in CUPS 2.x, this may not be the case in future major versions.
- Printer not found: Run the installer again to re-scan for available CUPS printers
- Duplex not working: Check that your physical printer supports duplex; verify with
lpadmin -p <printername> -lto list capabilities - Filter errors: Check CUPS error log at
/var/log/cups/error_log - Permission denied: Ensure you run the installer with
sudo
MIT
Please fork this project, as I probably won't have time to look into issues.