• Skip to content
  • Skip to link menu
KDEPrint Homepage
  • KDEPrint Homepage / Hacks / Acroread7 + kprinter
 
 

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 ]

Inform

Skip menu "Inform"
  • Home
  • KDE Home
  • News
  • Information
  • People
  • Mailing Lists
  • In The Media
  • Get Involved

KDEPrint

Skip menu "KDEPrint"
  • Overview
  • Screenshots
  • Hacks
    • Acroread7 + kprinter

Documentation

Skip menu "Documentation"
  • FAQ
  • KDEPrint Handbook
  • Tutorials
  • User Contributions

Downloads

Skip menu "Downloads"
  • Downloads

Develop

Skip menu "Develop"
  • Developer Resources
  • Work plan

Global navigation links

  • KDE Home
  • KDE Accessibility Home
  • Description of Access Keys
  • Back to content
  • Back to menu

Search:


Maintained by printing.kde.org Webmaster
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal