Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Creating Printer Queue Definitions

Matthew Warren edited this page Feb 25, 2017 · 8 revisions

Creating your printer queue definitions is likely the biggest hurdle you'll face implementing Self Service Printer Installer. To help, you'll use the generator.py script to convert a CSV list of your printers into a usable JSON document, which is then injected into the master printer-installer.py script.

Creating Your Printer CSV List

If you're lucky, your organization already has some sort of listing or inventory of your networked printers. While a number of columns are required, the utility is flexible enough to allow you to add an unlimited number of attributes to each printer queue definition. These attributes can be used to filter the list of available queues presented to the end user (i.e. filter by location, color mode, manufacturer, etc).

Use whatever data you already have as a starting point!

Required Fields

Your inventory CSV must contain the following fields (specified as headers):

DisplayName,URI,Driver,DriverTrigger,Location,Options
  • DisplayName: The name of the printer queue as will be shown in both the GUI selection window as well as in the Printers & Scanners preference pane.
  • URI: The URI to the print queue, ex. smb://printserver.example.tld/Example. Include the full URI including protocol. You should be able to specify smb, ipp, lpd, etc.
  • Driver: The full path to the driver as it should be installed on the client system (usually in /Library/Printers/PPDs/Contents/Resources/). Used to detect whether or not the driver is installed, as well as during the mapping operation. Leave blank if no vendor driver is required to simply use the default 'Generic PostScript' driver.
  • DriverTrigger: A 'custom trigger' to call a JAMF policy which installs printer drivers. If the "Driver" field is not blank and the specified driver is not found on the client system, the script will run jamf policy -event [DriverTrigger]. You'll need to set up appropriate policies on your JSS to install the required software.
  • Location: The physical location of the printer, as you want it to appear in Printers & Scanners.
  • Options: A space-separated list of printer options specified in key=value pairs, for example: APOptionalDuplexer=True printer-is-shared=false. These are simply lpoptions listed individually, as you might set via lpoptions -p PRINTERNAME -o key=value. This field is required to be present, but may be left blank if you do not wish to set any options. See (TODO: Determining Printer Options)

Optional Fields

  • CUPSName: The name of the print queue as known to CUPS. This can sometimes differ from the display name, but will usually be the same. I've included it better determine if a queue is already mapped on the client system. Specifically, if a queue hosted on a Window print server has been previously mapped through macOS's built-in GUI, CUPS will prepend the name with SERVERHOSTNAME_, i.e. SERVERHOSTNAME_QUEUENAME.

Additional / Filter Fields

Beyond the required fields, your printer inventory CSV can contain any number of additional attributes about each printer. Just create additional columns with a named header and go to town!

This is useful if you choose to implement filtering functionality. For instance, add a "Building" field and populate each row with the name of the building where the printer resides. You can then set up a JAMF policy for each building on your campus, scoped to the users in that building, so that Self Service Printer Installer displays only the printers available in a user's building. Or, add a "ColorPrinting" field with "True" or "False" values for each printer – now you can display only color printers. The sky's the limit.

Note: Currently only a single filter is supported when running the installer script.

Example Files

An example printers.csv is found in the examples/ directory. You can run a test by executing:

python generator.py examples/printers.csv