Here is a shell script which removes the printer information from the Pages document. This way Pages offers the default printer.
Also, AppleScript code is provided, so you can remove the printer information from the Pages document easily via the (right-click) context menu in Finder.
The resulting file (<filename>.noprinter.pages) may be slightly larger since the original internal file is preserved in the new Pages document (which is technically a ZIP-file).
Of course, there is no warranty or liability according to sections 15 and 16 and their interpretation in section 17 of the current GNU General Public License:
http://www.gnu.org/licenses/gpl-3.0-standalone.html
The original shell script is taken from here:
http://www.macosxhints.ch/index.php?page=2&hintid=2511
In order to get it work with Mac OS X 10.6.4 with Pages '09 version 4.0.4 I changed the calls of "mktemp", also I added a command to remove the temporary directory finally.
To do the whole thing via the (right-click) context menu in Finder, run "Automator" and click "New Service", then choose "Run AppleScript" from the Library.
An instruction for an older version of Mac OS, to some extent similar, is provided here:
http://www.faqintosh.com/risorse/en/guides/as/guide/findermenu/
Apple Magic
Shell script:
#!/usr/bin/env bash
PROG_NAME="$(basename "${0}")"
PROG_DIR="$(cd "$(dirname "${0}")" && pwd)"
XSLT="$(cat <<EOF
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sl="http://developer.apple.com/namespaces/sl">
<xsl:template match="sl:NSPrinter" />
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
EOF
)"
for i in unzip xsltproc zip ; do
if ! which >/dev/null "${i}" ; then
echo 1>&2 "${PROG_NAME}: missing ${i}"
exit 1
fi
done
if [ "${#}" -eq 0 ] ; then
echo "usage: ${PROG_NAME} [PAGES_FILE...]"
exit
fi
basewd="${PWD}"
for i in ${1+"${@}"} ; do
echo -n "working on ${i}..."
idir="$(cd "$(dirname "${i}")" && pwd)"
ibase="$(basename "${i}")"
if [ -d "${i}" ] ; then
inplace=1
else
inplace=''
fi
if [ -z "${inplace}" ] ; then
# Changed
iwdir="$(mktemp -d /tmp/${PROG_NAME}.XXXXXX)"
unzip -d "${iwdir}" -q "${i}"
else
iwdir="${i}"
gunzip > "${iwdir}/index.xml" -c "${iwdir}/index.xml.gz"
fi
echo "${XSLT}"
| xsltproc >"${iwdir}/index.xml.tmp" - "${iwdir}/index.xml"
if [ -z "${inplace}" ] ; then
# Changed
iorig="$(TMPDIR= mktemp -d "${iwdir}"/index.xml.orig.XXXXXX)"
cp -Rfp "${iwdir}/index.xml" "${iorig}"
cat "${iwdir}/index.xml.tmp" >"${iwdir}/index.xml"
else
# Changed
iorig="$(TMPDIR= mktemp -d "${iwdir}"/index.xml.gz.orig.XXXXXX)"
cp -Rfp "${iwdir}/index.xml.gz" "${iorig}"
gzip >"${iwdir}/index.xml.gz" -c "${iwdir}/index.xml.tmp"
fi
rm -f "${iwdir}/index.xml.tmp"
if [ -z "${inplace}" ] ; then
inew="${idir}/${ibase%.*}.noprinter.${ibase##*.}"
cd "${iwdir}"
zip -9qry "${inew}" .
cd "${basewd}"
# Added
rm -rf "${iwdir}"
fi
echo done
done
AppleScript code for integration into the Finder context menu:
on run {input, parameters}
repeat with theItem in input
do shell script "~/bin/rm_pages_sticky_printer_mac_os_10.6.4_pages_09_ver_4.0.4.sh " & quoted form of POSIX path of theItem
end repeat
return input
end run