Hacks
Using kprinter as print command with Acrobat Reader 7.0
by Kurt Pfeifle, Network Printing Consultant, Danka Deutschland GmbH, <kpfeifle@danka.de>
Acrobat Reader 7 for Linux isn't well tested by Adobe at all when in comes to printing. For example, it breaks the recommended kprinter usage that worked for previous versions. <RANT>It even looks like Adobe isn't even aware of such a wonderful tool like kprinter!</RANT>
The reason for acroread7's failure to print via kprinter lies in the frequent occurrence where deletion of the temporary printfile created by acroread7 happens before kprinter had a chance to send it on to the printer.
I am now tired of answering individually all those questions coming into my private mailbox.
So here is a wrapper script that works around that issue. It is by and large self-documenting. (You may want to adapt it to other shells than Bash.) Enjoy!
#!/bin/bash
#
# (c) Kurt Pfeifle <pfeifle@kde.org>
# This is Free Software; use at your own peril
#
# README
# ======
# 1. Save this file as /usr/local/bin/kprinter4acroread7:
# 2. Make it executable
# 3. Make "kprinter4acroread7" the print command of Acrobat Reader 7 for Linux
#
# WARNING
# =======
# This is not very secure! Any user on the system can read (and even manipulate
# the temporary print file while it is in existence). This is a quick'n' dirty
# script to enable you to print at all with kprinter. Use your own creativity
# to make this more secure.
#
# At first, determine name for a new temporary file, which can not be deleted
# by acroread7
tempfile="/tmp/acroread7-$$-printfile.ps"
touch tempfile
[ -f "${tempfile}" ] && exit 1
# Comment the following "echo" lines if you want no log file.
logfile="/tmp/kprinter4acroread7.printlog"
echo "" >> ${logfile}
echo "-------- new job ----------------------------------------------" >> ${logfile}
echo "$(date)" >> ${logfile}
echo "" >> ${logfile}
echo "$$ is the current PID of ${0}" >> ${logfile}
echo "${1} is acroread's output filename" >> ${logfile}
echo "${tempfile} is the new temporary file beyond acroread's control" >> ${logfile}
echo "" >> ${logfile}
echo "WARNING:" >> ${logfile}
echo "--------" >> ${logfile}
echo " The files ${tempfile} and ${1} are available" >> ${logfile}
echo " to other users for reading or manipulation!" >> ${logfile}
# Copy acroread's file to the new file
# (first argument is acroread's output)
cp "${1}" ${tempfile}
# Hand this file to kprinter
kprinter ${tempfile}
# alternative way to call kprinter, with forcing a "fit to page" print option:
#kprinter -o fitplot=true ${tempfile}
# (Ihis is useful if you print PDFs designed for A4 on Letter paper or vice versa.
# It doesnt harm if you print PDFs designed for A4 actually on A4 paper.)
# Remove temp file after we are done
rm -f ${tempfile}
[ Edit ]
KDEPrint Homepage