Normally, you can use a script to set CUPS printing options for each printer. These options are set at printer installation:
#!/bin/sh # install printer lpadmin -p "Xrx_6700_Techlab" \ -D "Xerox-6700-Techlab" \ -L "Tech Center" \ -E \ -v "smb://it/Xerox-6700-Techlab" \ -P "/Library/Printers/PPDs/Contents/Resources/Xerox Phaser 6700DN.gz" \ -o printer-is-shared=false \ -o Duplex=None \ -o auth-info-required=username,password \ -o InputSlot=Tray2
Each -o command will edit an option available on the printer. Available options can be displayed using the lpoptions utility:
# check printer options lpoptions -p Xrx_6700_Techlab -l
Unfortunately, for some printers, setting CUPS options does not apply to the GUI print window. In case of the Xerox 6700, setting the Tray2 option in CUPS does not apply it in the GUI. We can use a script that will modify the available printer presets for the user as a workaround.
Use an installer pkg that will deploy a pre-configured plist with the presets. The pkg should include a postinstall script to modify the plist for the user.
Printer GUI Presets can be created on any system and then copied out - the plist resides in ~/Library/Preferences/ com.apple.print.custompresets.forprinter.QUEUE_NAME.plist
After the installer pkg copies this file onto the new user's home, a script will be needed to change its settings to reflect the new user and the new system:
#!/bin/bash # define username USERNAME=$(logname) # define variables XR6700PLIST="/Users/${USERNAME}/Library/Preferences/com.apple.print.custompresets.forprinter.Xrx_6700_Techlab.plist" CHOSTKEY=":Xerox6700-Plain:com.apple.print.preset.settings:com.xerox.printsettings:XRClientHostv4" CNAMEKEY=":Xerox6700-Plain:com.apple.print.preset.settings:com.xerox.printsettings:XRClientName" FNAMEKEY=":Xerox6700-Plain:com.apple.print.preset.settings:com.xerox.printsettings:XRFullUsername" SNAMEKEY=":Xerox6700-Plain:com.apple.print.preset.settings:com.xerox.printsettings:XRUsername" OSKEY=":Xerox6700-Plain:com.apple.print.preset.settings:com.xerox.printsettings:XROSVersion" CHOSTKEYC=":Xerox6700-Cardstock:com.apple.print.preset.settings:com.xerox.printsettings:XRClientHostv4" CNAMEKEYC=":Xerox6700-Cardstock:com.apple.print.preset.settings:com.xerox.printsettings:XRClientName" FNAMEKEYC=":Xerox6700-Cardstock:com.apple.print.preset.settings:com.xerox.printsettings:XRFullUsername" SNAMEKEYC=":Xerox6700-Cardstock:com.apple.print.preset.settings:com.xerox.printsettings:XRUsername" OSKEYC=":Xerox6700-Cardstock:com.apple.print.preset.settings:com.xerox.printsettings:XROSVersion" CHOSTKEYO=":com.apple.print.lastUsedSettingsPref:com.apple.print.preset.settings:com.xerox.printsettings:XRClientHostv4" CNAMEKEYO=":com.apple.print.lastUsedSettingsPref:com.apple.print.preset.settings:com.xerox.printsettings:XRClientName" FNAMEKEYO=":com.apple.print.lastUsedSettingsPref:com.apple.print.preset.settings:com.xerox.printsettings:XRFullUsername" SNAMEKEYO=":com.apple.print.lastUsedSettingsPref:com.apple.print.preset.settings:com.xerox.printsettings:XRUsername" OSKEYO=":com.apple.print.lastUsedSettingsPref:com.apple.print.preset.settings:com.xerox.printsettings:XROSVersion" NEWCHOST=$(ifconfig | grep -i 192 | cut -d " " -f2) NEWCNAME=$(scutil --get ComputerName) NEWFNAME=$(finger `logname` | awk -F: '{ print $3 }' | head -n1 | sed 's/^ //') NEWOS=$(defaults read /System/Library/CoreServices/SystemVersion.plist ProductVersion) TECHLABCHECK=$(lpstat -p | grep -i techlab | cut -d " " -f2) TECHLAB="Xrx_6700_Techlab" # install or re-install printer if [[ $TECHLABCHECK == $TECHLAB ]]; then echo "Outdated printer settings detected. Removing..." lpadmin -x Xrx_6700_Techlab echo "Installing printer..." lpadmin -p "Xrx_6700_Techlab" \ -D "Xerox-6700-Techlab" \ -L "Tech Center" \ -E \ -v "smb://it/Xerox-6700-Techlab" \ -P "/Library/Printers/PPDs/Contents/Resources/Xerox Phaser 6700DN.gz" \ -o printer-is-shared=false \ -o Duplex=None \ -o auth-info-required=username,password \ -o InputSlot=Tray2 else echo "Printer not found. Installing..." lpadmin -p "Xrx_6700_Techlab" \ -D "Xerox-6700-Techlab" \ -L "Tech Center" \ -E \ -v "smb://it/Xerox-6700-Techlab" \ -P "/Library/Printers/PPDs/Contents/Resources/Xerox Phaser 6700DN.gz" \ -o printer-is-shared=false \ -o Duplex=None \ -o auth-info-required=username,password \ -o InputSlot=Tray2 fi # copy plist echo "Copying new Xerox 6700 custom plist..." cp /usr/local/share/com.apple.print.custompresets.forprinter.Xrx_6700_Techlab.plist /Users/${USERNAME}/Library/Preferences/com.apple.print.custompresets.forprinter.Xrx_6700_Techlab.plist # update plist attributes echo "Updating attributes..." /usr/libexec/PlistBuddy -c "Set ${CHOSTKEY} ${NEWCHOST}" $XR6700PLIST /usr/libexec/PlistBuddy -c "Set ${CNAMEKEY} ${NEWCNAME}" $XR6700PLIST /usr/libexec/PlistBuddy -c "Set ${FNAMEKEY} ${NEWFNAME}" $XR6700PLIST /usr/libexec/PlistBuddy -c "Set ${SNAMEKEY} ${USERNAME}" $XR6700PLIST /usr/libexec/PlistBuddy -c "Set ${OSKEY} ${NEWOS}" $XR6700PLIST /usr/libexec/PlistBuddy -c "Set ${CHOSTKEYC} ${NEWCHOST}" $XR6700PLIST /usr/libexec/PlistBuddy -c "Set ${CNAMEKEYC} ${NEWCNAME}" $XR6700PLIST /usr/libexec/PlistBuddy -c "Set ${FNAMEKEYC} ${NEWFNAME}" $XR6700PLIST /usr/libexec/PlistBuddy -c "Set ${SNAMEKEYC} ${USERNAME}" $XR6700PLIST /usr/libexec/PlistBuddy -c "Set ${OSKEYC} ${NEWOS}" $XR6700PLIST /usr/libexec/PlistBuddy -c "Set ${CHOSTKEYO} ${NEWCHOST}" $XR6700PLIST /usr/libexec/PlistBuddy -c "Set ${CNAMEKEYO} ${NEWCNAME}" $XR6700PLIST /usr/libexec/PlistBuddy -c "Set ${FNAMEKEYO} ${NEWFNAME}" $XR6700PLIST /usr/libexec/PlistBuddy -c "Set ${SNAMEKEYO} ${USERNAME}" $XR6700PLIST /usr/libexec/PlistBuddy -c "Set ${OSKEYO} ${NEWOS}" $XR6700PLIST # set the default preset echo "Setting the default preset..." defaults write $XR6700PLIST com.apple.print.lastPresetPref "Xerox6700-Plain" defaults write $XR6700PLIST com.apple.print.lastPresetPrefType -int 4 # set permissions echo "Fixing permissions..." chown $USERNAME $XR6700PLIST chmod 600 $XR6700PLIST exit 0
When the installer completes, the user should see the following presets for the Xerox 6700 printer. The default will be the tray 2 plain paper setting: