iPrint List

PHP Script which creates a web page of iPrint Servers from a csv file.

This php page is designed for larger iPrint implementations with buildings at multiple sites. A csv file contains a list of each building and the iprint server related to that building and the page uses that to present a list of all sites, ordered in various ways. It also does a comparison of the calling ip address in order to present the user with the nearest server at the top of the list, which is usually the one they will want to select a printer from.

An example csv file is included. The file and code includes three columns for the name of the building. My organisation seems to refer to some buildings by multiple names, so it helps our users, but its not necessary to use them all. You'll almost certainly want to customise the html to suit your intranet look and feel. There are hooks in the code where you can insert html style class tags and so on.

To install this you need to have a web server which supports php. The tool is tested and installed on Netware 6.5 with Apache, but should be capable of running on other combinations of web server and operating system provided that php is installed and configured with LDAP support. I recommend you create a new folder for the application files in the web server root folder. On an "out of the box" NW65 install this will be sys:Apache2\htdocs, so create sys:Apache\htdocs\iprintlist. Extract the two files from the zip archive, iprintlist.php and iprintsites.csv into this folder.

The next task is to configure the csv file to contain your servers and offices. You need to enter all your servers into this file, together with the town and building name(s). Most columns are obvious: note that you should use the complete server name including DNS domain. The subnet needs a little more explanation. In order to decise whether there is a "nearest site" the script compares the address of the calling workstation with that of each server. If there is a match then that server is presented as "nearest site". In the script below workstations 10.100.1.1 and 10.100.254.1 would match up with server fs1, workstation 10.101.1.1 would match up with server fs2a, but workstation 10.101.2.1 wouldn't match with any servers.

Town,Server,IPSubnet, Notes, BuildingName1, BuildingName2, BuildingName3
Atown, fs1.yourdomain.com, subnet 10.100,All printers, Atown Sub Office,Park Street,Finance Offices
Atown, fs2a.yourdomain.com, subnet 10.101.1, 1st and 2nd Floors,Headquarters, Company House,,
Atown, fs2b.yourdomain.com, subnet 10.101.100, 3rd 4th and 5th Floors,Headquarters, Company House,,
Btown, fs3.yourdomain.com, subnet 10.130, All printers, Btown Office,Sales Building,    

To run the script start a web browser on an appropriate device and point it at the iprintlist.php script. In the example above the url would be http://[servername]/printlist/iprintlist.php. From there on it should be self explanatory. The script should run on any reasonably recent web browser and client operating system, but of course the platform will also need to support iprint to download drivers etc.

Change History

  1. 19 November 2008 - Initial public release.
  2. 14 May 2009 - Additional instructions and a small bug fix - there was a little site specific code left in the script
  3. 24 Jan 2010 - Minor html syntax correction in iprintlist.php

Download

Download zip archive


These snippets and utilities are licensed under the University of Illinois/NCSA Open Source License. Here is the text of the license as it applies to this code.

To contact the writer please use this form, or if you prefer use Linked In or even Facebook.

HTML check . CSS check

© Jim Champ, last edit