Installing FindMe Print Queues on MacOS

Installing FindMe Print Queues Without Mobility Print (MacOS)

Preamble

Mobility Print as a print queue installer works fine when clients need to install printers on their own devices, such as their phone or personal laptop. However, on managed devices, this is a sub-optimal solution, as it installs all of the published queues, cluttering the user's printer selection.

What's worse is using Mobility Print will not allow for the use of advanced printer features like paper tray selection, stapling, and 2/3 hole punch since it uses a generic AirPrint driver. Oh no!

PaperCut has a universal Windows driver, but us Mac users are left high and dry seemingly without any solution!

To remedy this, we have found the best solution is to substitute a PostScript3 driver for your specific copier models. Specifically, what we have found works best is using the PostScript PPD file for the highest end copier in your fleet.

If you have multiple different brands of copiers in your fleet, you may need to create separate FindMe queues for each brand of copier, but you could experiment with each PostScript3 driver, and see if it works on other brands of copiers.

To remedy the problems with Mobility Print, you can use two different options to manage printers and/or FindMe queues from PaperCut on managed devices.

Connection Options

Option 1 - Line Printer Daemon

Option 2 - Internet Printing Protocol (Secure)

Installation

After selecting which option you want to use (lpd:// or ipps://), start constructing a script to deploy the printers. Refer to the information above for more information.

Prerequisites

  1. From the print server, select the print queue from Windows settings, and ensure that the printer is shared. Make note of the name that the printer is shared as, as it will be needed later.

  2. Make sure that any queues on the print server are using the same driver type as the Mac client devices. From testing, it seems that both need to be using the PostScript3 driver if possible. If a PostScript driver is not available for your copiers and/or printers, you may have to experiment to see what works for you.

  3. If you are using PaperCut Virtual FindMe queues, you may wish to set up additional queues, like if you want a Color versus Grayscale option for users. Refer to PaperCut's documentation to configure a FindMe queue. Make sure the FindMe queue is shared from the print server, and working correctly.

https://www.papercut.com/discover/easy-printing/find-me-printing/

  1. Make sure that PaperCut NG/MF is configured how you want it on the server. Settings like Print Release and FindMe queues may need to be adjusted or configured if have created new FindMe queues. If you created a grayscale queue, now would be the time to set it to convert jobs for all users to grayscale from the PaperCut interface.

  2. If previously installed, make sure the PaperCut Mobility Client has been removed. This is extremely important, since it can and will cause problems. Mobility Print will try to override the printer automatically when it decides to sync to the server, which will nuke our configuration. Boom!

Step 1 - Driver Installation

    # variable to hold the path to the PPD file
    PPD_PATH="/path/to/PPD.ppd.gz"

    # simple command to detect the PPD path
    if [ ! -f "$PPD_PATH" ]; then
        echo "PPD not found!"
    else
        echo "PPD exists!"
    fi
    # Variables
    DRIVER_URL="https://apps.mydomain.tld/CopierBrand_PS3_Driver.pkg"
    TEMP_PACKAGE_NAME="CopierBrand_PS3_Driver.pkg"

    # Download the driver
    echo "Downloading driver..."
    curl -L "$DRIVER_URL" -o "/tmp/$TEMP_PACKAGE_NAME" 2>/dev/null

    # Install the driver
    echo "Installing driver..."
    installer -pkg "/tmp/$TEMP_PACKAGE_NAME" -target /

Step 2 - Printer Installation

    lpadmin -p "User-Visible-PrinterName" -v "lpd://ip.of.print.server/ServerPrintQueue" -P "/Library/Printers/PPDs/Contents/Resources/PS3PPDfile.ppd.gz" -o printer-is-shared=false

Step 3 - Printer Configuration

FindMe Queues:

Individual Printers/Copiers:

Finding Available Options:

Setting Available Options:

    lpadmin -p "PrinterName" -o "Option=MySetting"

Example Script

#!/bin/bash

# --------------------- Variables --------------------- #

# List of desired printers to be added
# These names should match the names of the print queues shared on the print server
DesiredPrinters=("ORG-FollowMe-Color" "ORG-FollowMe-Grayscale")
ColorPrinters=("ORG-FollowMe-Color")
GrayscalePrinters=("ORG-FollowMe-Grayscale")

# List of printers to be removed
# This is useful if you have printers you don't want, or are trying to replace
# If you don't have any printers you want to remove, just set PrinterNames=()
PrinterNames=("Printer1" "Printer2")

# Print server connection configuration
SocketType="ipps://"
ServerIP="0.0.0.0" # can be set via local IP or local DNS name

# Driver download URL
DRIVER_URL="https://apps.yourdomain.tld/CopierBrand_PS3_Installer.pkg"
TEMP_PACKAGE_NAME="CopierBrand_PS3_Installer.pkg" # name of package in /tmp directory

# Path to the PPD file used for configuring the printers
PPD_PATH="/Library/Printers/PPDs/Contents/Resources/PS3PPDfile.ppd.gz"

# List of variables to set for the desired printers
# These values were grabbed from a Canon C7765i, modify them to your needs
# Remember you can get all of the available options for your copier using the lpoptions command
# Common Options are set for both color and grayscale
CommonOptions=("PageSize=Letter" "Collate=True" "CNDuplex=None" "CNPuncher=PUNU23" "CNFinisher=BFINX1")
ColorOptions=("CNColorMode=color" "ColorModel=RGB" "CNUseGrayScaleProfile=False")
GrayscaleOptions=("CNColorMode=mono" "ColorModel=Gray" "CNUseGrayScaleProfile=True")

# --------------------- Functions --------------------- #

configure_printers() {
    # Set the printer PPD file for the desired printers
    echo "Setting printer PPD file..."
    for DesiredPrinter in "${DesiredPrinters[@]}"
    do
        lpadmin -p "$DesiredPrinter" -P "$PPD_PATH" 2>/dev/null
        echo "PPD file set for $DesiredPrinter."
    done

    # Ensure printer sharing is disabled on the client devices
    echo "Applying shared printer options..."
    for CommonOption in "${CommonOptions[@]}"
    do
        for DesiredPrinter in "${DesiredPrinters[@]}"
        do
            lpadmin -p "$DesiredPrinter" -o "$CommonOption" 2>/dev/null
            echo "Applied $CommonOption to $DesiredPrinter."
        done
    done

    # Apply color printer options
    echo "Applying color printer options..."
    for ColorPrinter in "${ColorPrinters[@]}"
    do
        for ColorOption in "${ColorOptions[@]}"
        do
            lpadmin -p "$ColorPrinter" -o "$ColorOption" 2>/dev/null
            echo "Applied $ColorOption to $ColorPrinter."
        done
    done

    # Apply grayscale printer options
    echo "Applying grayscale printer options..."
    for GrayscalePrinter in "${GrayscalePrinters[@]}"
    do
        for GrayscaleOption in "${GrayscaleOptions[@]}"
        do
            lpadmin -p "$GrayscalePrinter" -o "$GrayscaleOption" 2>/dev/null
            echo "Applied $GrayscaleOption to $GrayscalePrinter."
        done
    done

    # Loop over every printer and disable printer sharing
    echo "Disabling printer sharing..."

    cupsctl --no-share-printers 2>/dev/null
    echo "Global printer sharing disabled."

    # Loop over individual printers and disable sharing
    for DesiredPrinter in "${DesiredPrinters[@]}"
    do
        lpadmin -p $DesiredPrinter -o printer-is-shared=false
        echo "Printer sharing disabled for $DesiredPrinter."
    done
}

# --------------------- Housekeeping --------------------- #

# Remove unwanted or old printers
echo "Searching for and removing unwanted printers..."
for PrinterName in "${PrinterNames[@]}"
do
    # test if the printer was found
    lpstat -p "$PrinterName" >/dev/null 2>&1 # mute all output
    status=$?
    if [ $status -eq 0 ]; then
        lpadmin -x "$PrinterName" 2>/dev/null
        echo "Deleted $PrinterName"
    fi
done

# Ensure Mobility Print has been removed
# Check if PaperCut is installed (otherwise will override PS3 driver on installed printers)
# This is a failsafe to ensure the PS3 driver is used
if [ -d "/Applications/PaperCut Mobility Print Client" ]; then
    echo "PaperCut Mobility Client detected. Removing..."
    rm -rf "/Applications/PaperCut Mobility Print Client"
    echo "PaperCut Mobility Client deleted."
fi

# Check if desired printers were found
echo "Checking if desired printers are installed..."
allPrintersFound=true
for DesiredPrinter in "${DesiredPrinters[@]}"
do
    lpstat -p "$DesiredPrinter" 2>/dev/null
    status=$?
    if [ $status -ne 0 ]; then
        echo "Printer $DesiredPrinter not found."
        allPrintersFound=false
    fi
done

# Check if valid PPD file is found, else override the allPrintersFound variable
# this prevents attempted configuration without valid PPD file (error)
if [ ! -f "$PPD_PATH" ]; then
    echo "PPD file not found. Skipping configuration..."
    allPrintersFound=false
fi

if $allPrintersFound; then
    # Configure the printers
    echo "All desired printers found. Ensuring configuration is set..."
    configure_printers
    echo "Configuration complete."

    # Print completion message
    echo "Script complete. Exiting..."
    exit 0
fi

# --------------------- Driver Installation --------------------- #

# Check if the PPD file exists
if [ ! -f "$PPD_PATH" ]; then
    echo "PPD file not found. Driver will now be downloaded..."

    # Download the driver
    echo "Downloading driver..."
    curl -L "$DRIVER_URL" -o "/tmp/$TEMP_PACKAGE_NAME" 2>/dev/null

    # Install the driver
    echo "Installing driver..."
    installer -pkg "/tmp/$TEMP_PACKAGE_NAME" -target /

    # Check if the PPD file exists
    if [ ! -f "$PPD_PATH" ]; then
        echo "PPD file still not found. Ensure your DRIVER_URL variable is set correctly and is reachable."
        echo "Exiting script..."
        exit 1
    fi
else
    echo "PPD file found. Continuing with installation."
fi

# --------------------- Printer Installation --------------------- #

# Create the desired printers from the list.
echo "Adding desired printers..."
for DesiredPrinter in "${DesiredPrinters[@]}"
do
    lpadmin -p "$DesiredPrinter" -v "$SocketType$ServerIP$DesiredPrinter" -P "$PPD_PATH" -o printer-is-shared=false 2>/dev/null
    echo "$DesiredPrinter created with lpadmin."
done

# --------------------- Verify Installation --------------------- #

# Check if the printers were installed
allPrintersFound=true
for DesiredPrinter in "${DesiredPrinters[@]}"
do
    lpstat -p "$DesiredPrinter" 2>/dev/null
    status=$?
    if [ $status -ne 0 ]; then
        echo "Printer $DesiredPrinter not found."
        allPrintersFound=false
    fi
done

if $allPrintersFound; then
    echo "All desired printers added successfully."
else
    echo "Not all desired printers found."
    echo "Verify the printers are shared on the server and the names are correct."
    echo "Exiting script..."
    exit 1
fi

# --------------------- Printer Configuration --------------------- #

# Print configuring message
echo "Configuring printers..."

# Configure the printers
configure_printers

# Print completion message
echo "Printer configuration complete."

# --------------------- End --------------------- #

# Print completion message
echo "Script complete. Exiting..."
exit 0