| oz_penguin ( @ 2009-07-02 15:15:00 |
| Current mood: | |
| Current music: | The slightly louder hum of computer fans... |
| Entry tags: | "macos x", printing |
Defining global printer presets for all users on a MacOS X computer
Note: All references to "MacOS X" in the following apply to Leopard (MacOS 10.5) and Tiger (MacOS 10.4). I haven't needed to investigate how the earlier versions did things.
As part of the implementation of our new unified printing and copying system, I needed to find a way to enforce some printing defaults on the various printer queues. On the Windows side this was relatively easy; settings assigned to the queues on the print server are inherited by all users on the domain.
MacOS X does things a bit differently. One of the things I like about Mac printing is that users can create printer "presets" that are printer-independent. You start with the default "Standard" preset, make the changes you want (eg duplex printing, forced B&W output etc), and then save the new profile under a name of your choice. You can use these profiles with any of your printers, and the Mac quietly ignores any of the settings that don't apply to that particular printer (eg duplex printing on a printer that can't duplex).
Each user on the Mac can have their own set of unique presets. Leopard and Tiger store the printer presets in the file
~/Library/Preferences/com.apple.print.cu
But what if you want to provide a common set of presets to all users on the Mac?
It turns out to be relatively simple.
Log on to the machine as a user with admin privileges. Rename
~/Library/Preferences/com.apple.print.cu
to
~/Library/Preferences/com.apple.print.cu
Why? Because it may already contain custom presets that you don't want to provide to all users.
Now, fire up an application that is able to print something (a web browser is a good example). Create the various custom presets you need. In our case, we had 4 custom presets:
- BandW duplex
- BandW single-sided
- Colour duplex
- Colour single-sided
Once you've created all of the presets you need, select the one you want to be the default, and then print something. A single page is fine. This ensures that the value of the field "com.apple.print.lastPresetPref" in your .plist file is set to the correct value (if you have the developer tools installed, you can user Property List Editor to set this value instead of having to print).
Once you've done that, close all of your open applications. You need to change the permissions on
~/Library/Preferences/com.apple.print.cu
to make it universally readable, and then move the file into
/Library/Preferences
This makes the presets available to all users on the Mac.
It's possible, however, that a user already have their own set of custom presets. It's even possible that they have a preset with the same name as one of your new global presets. If so, their preset will mask the global preset. Running the following Perl script using sudo will rename all users custom presets files. Renaming is safer than deleting, as you're just as likely to find one user who spent months perfecting their printer profiles to get the best output when printing photos etc, and you'll want to be able to re-instate them if needed.
#!/usr/bin/perl
$subPath="/Library/Preferences/";
$oldName="com.apple.print.custompresets.p list";
$newName="com.apple.print.custompresets-o ld.plist";
@paths=;
foreach $path (@paths) {
$path2check= "$path$subPath$oldName";
$newPath= "$path$subPath$newName";
if (-e $path2check) {
rename $path2check, $newPath;
}
}
To push this out site-wide, I used package maker to create an installer package that installed the new global presets and ran the Perl script post-install. I then pushed it out to all of our Macs using Apple Remote Desktop.