On 12-Feb-2003/15:37 +0800, Kevin - KD Micro Software <[EMAIL PROTECTED]> wrote:
>I'm looking for a command line text based utility that can print PDF
>files.  I know the cups print system does this, but it would be a lot
>easier if there was a command line tool that could do this for me under
>the standard lpd.


#!/bin/sh
#
# Print the PDF file named on the command line.
#
# Copyright (c) 2003, Anthony E. Greene <mailto:[EMAIL PROTECTED]>
# License: GNU GPL <http://www.gnu.org/licenses/gpl.txt>
#

# Get the process ID and name of the script to generate a unique
# name for the tempfile.
pid=$$
scriptname=`basename $0`
tempfile="/tmp/$scriptname.$pid.ps"

# Make sure a readable PDF file was named on the command line.
pdffile="$1"
if [ -r "$pdffile" ]; then
  # A readable file was named. See if it's PDF.
  pdfstring=': PDF document, version '
  ispdf=`file "$pdffile" | grep -c "$pdfstring"`
  if [ $ispdf -eq 0 ]; then
    echo "$pdffile is not a PDF file"
    exit 2
  fi
else
  echo "$scriptname Error: Unable to read PDF file: $pdffile"
  exit 1
fi


# Convert PDF to PostScript.
pdftops "$pdffile" "$tempfile"

# Print and remove the tempfile.
lpr "$tempfile"
rm "$tempfile"


-- 
Anthony E. Greene <mailto:[EMAIL PROTECTED]%3E>
OpenPGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
AOL/Yahoo Messenger: TonyG05    HomePage: <http://www.pobox.com/~agreene/>
Linux. The choice of a GNU generation <http://www.linux.org/>



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to