--- /dev/null
+.\" $Id$
+.\"
+.\" HylaFAX Facsimile Software
+.\"
+.\" Copyright (c) 1990-1996 Sam Leffler
+.\" Copyright (c) 1991-1996 Silicon Graphics, Inc.
+.\" HylaFAX is a trademark of Silicon Graphics
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and
+.\" its documentation for any purpose is hereby granted without fee, provided
+.\" that (i) the above copyright notices and this permission notice appear in
+.\" all copies of the software and related documentation, and (ii) the names of
+.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
+.\" publicity relating to the software without the specific, prior written
+.\" permission of Sam Leffler and Silicon Graphics.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+.\"
+.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+.\" OF THIS SOFTWARE.
+.\"
+.if n .po 0
+.ds Fx \fIHyla\s-1FAX\s+1\fP
+.ds Ps P\s-2OST\s+2S\s-2CRIPT\s+2
+.TH PDF2FAX ${MANNUM1_8} "March 08, 2001"
+.SH NAME
+pdf2fax \- image Portable Document Format file for facsimile transmission
+by \*(Fx
+.SH SYNOPSIS
+.B ${SPOOL}/bin/pdf2fax
+[
+.I options
+] [
+.IR files ...
+]
+.SH DESCRIPTION
+.I pdf2fax
+takes Portable Document Format (PDF) input and generates a
+.SM TIFF
+Class F image file suitable for facsimile transmission.
+It is usually invoked by the \*(Fx scheduler process,
+.IR faxq (${MANNUM1_8}).
+PDF imaging is typically done using the
+freely available
+.I Ghostscript
+software.
+.PP
+.I pdf2fax
+is actually a link (symbolic or otherwise) to the script
+appropriate for the PDF imaging tool.
+The link is setup when the
+.IR faxsetup (${MANNUM1_8})
+script is run to configure a \*(Fx server machine for use.
+.PP
+Input files containing PDF may be specified on the
+command line.
+If none are given, then
+.I pdf2fax
+will read from standard input.
+.PP
+By default,
+.I pdf2fax
+will generate a 98 line/inch output document whose
+page width is 1728 pixels and page length is 297 mm
+(a standard A4 page at low resolution).
+Horizontal resolution is always 204 dpi.
+Command line options may be used to select alternate
+vertical resolution and page dimensions.
+.PP
+If no filename is given,
+.I pdf2fax
+writes its output to a file named
+.BR pdf.fax ;
+the
+.B \-o
+option can be used to specify an alternate filename.
+.PP
+By default, output is compressed using the standard
+Group 3 1D-encoding scheme, with
+.SM EOL
+codes padded to byte boundaries.
+If the
+.B \-2
+option is specified, output is encoded with the optional
+Group 3 2D-encoding scheme (\c
+.SM EOL
+codes are still padded to byte boundaries).
+.PP
+Note that
+.B bin/pdf2fax
+is usually just a link to a shell script that invokes the
+appropriate PDF
+.SM RIP
+to do the work.
+.SH OPTIONS
+The following operations are recognized:
+.TP 10
+.B \-1
+Write Group 3 1D-encoded data to the output file.
+.TP 10
+.B \-2
+Write Group 3 2D-encoded data to the output file.
+.TP 10
+.BI \-m " pages"
+Set the maximum number of pages that are permitted in the
+output file.
+If more pages are present in the input document then
+abort processing.
+.TP 10
+.BI \-o " file"
+Write output to the specified
+.I file
+instead of the default
+.B pdf.fax
+filename.
+.TP 10
+.BI \-w " width"
+Set the output page
+.IR width ,
+in pixels.
+By default, pages are 1728 pixels wide.
+.TP 10
+.BI \-l " length"
+Set the output page
+.IR length
+in millimeters.
+By default, pages are 297 millimeters long.
+.TP
+.BI \-r " vres"
+Set the vertical resolution,
+in lines/inch, at which to image the PDF.
+.SH "RUNTIME ENVIRONMENT"
+Before user-supplied PDF is passed
+to the PDF interpreter, a limited number of
+operators are defined.
+These operators are operators commonly found in a
+LaserWriter printer and (sometimes) generated by Macintosh-based
+applications.
+.PP
+The default Display PDF-based execution
+environment includes support for the following fonts:
+.sp .5
+.ta \w'AvantGarde-DemiOblique 'u +\w'Helvetica-Narrow-BoldOblique 'u
+.nf
+AvantGarde-Book Helvetica-Bold Palatino-BoldItalic
+AvantGarde-BookOblique Helvetica-BoldOblique Palatino-Italic
+AvantGarde-Demi Helvetica-Narrow Palatino-Roman
+AvantGarde-DemiOblique Helvetica-Narrow-Bold StoneSerif
+Bookman-Demi Helvetica-Narrow-BoldOblique Symbol
+Bookman-DemiItalic Helvetica-Narrow-Oblique Tekton
+Bookman-Light Helvetica-Oblique Times-Bold
+Bookman-LightItalic Lithos-Bold Times-BoldItalic
+Courier NewCenturySchlbk-Bold Times-Italic
+Courier-Bold NewCenturySchlbk-BoldItalic Times-Roman
+Courier-BoldOblique NewCenturySchlbk-Italic ZapfChancery-MediumItalic
+Courier-Oblique NewCenturySchlbk-Roman ZapfDingbats
+Helvetica Palatino-Bold
+.fi
+.sp .5
+Note that this is the same set of fonts supported by the
+.SM DPS
+extension to the X server.
+.PP
+The default Ghostscript-based environment is more uncertain;
+consult the Ghostscript documentation for information on
+what fonts are available.
+.SH FILES
+.ta \w'${SPOOL}/etc/dpsprinter.ps 'u
+.nf
+${SPOOL}/etc/dpsprinter.ps PDF code read at startup for \s-1DPS\s+1
+/usr/lib/DPS/default.dps_vm startup VM file for \s-1DPS\s+1
+/usr/lib/DPS/outline Type 1 fonts for \s-1DPS\s+1
+/usr/lib/DPS/prebuilt prebuilt versions of fonts for \s-1DPS\s+1
+.fi
+.SH BUGS
+Output from the Display PDF version of this command
+is encoded according to the Display PDF binary encoding
+protocol.
+.PP
+No prebuilt bitmap fonts are currently available for the
+.SM DPS\c
+-based imager;
+this would greatly improve legibility at low resolutions,
+as the rendering of outline fonts at 98 lpi is particularly
+poor.
+.PP
+Both
+.SM DPS-
+and
+Ghostscript-based versions of this program fail to exit with
+non-zero status when an invalid PDF document is processed;
+this makes it problematic for the \*(Fx queue manager to
+determine when a problem arises when preparing a job for
+transmission.
+.SH "SEE ALSO"
+.IR sendfax (1),
+.IR faxq (${MANNUM1_8}),
+.IR hylafax-server(${MANNUM4_5})
--- /dev/null
+#! /bin/sh
+# $Id$
+#
+# HylaFAX Facsimile Software
+#
+# Copyright (c) 1990-1996 Sam Leffler
+# Copyright (c) 1991-1996 Silicon Graphics, Inc.
+# HylaFAX is a trademark of Silicon Graphics
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+#
+# Convert PDF to facsimile using Ghostscript.
+#
+# pdf2fax [-o output] [-l pagelength] [-w pagewidth]
+# [-r resolution] [-m maxpages] [-*] [file ...]
+#
+# We need to process the arguments to extract the input
+# files so that we can prepend a prologue file that sets
+# up a non-interactive environment.
+#
+# NB: this shell script is assumed to be run from the
+# top of the spooling hierarchy -- s.t. the etc directory
+# is present.
+#
+
+test -f etc/setup.cache || {
+ SPOOL=`pwd`
+ cat<<EOF
+
+FATAL ERROR: $SPOOL/etc/setup.cache is missing!
+
+The file $SPOOL/etc/setup.cache is not present. This
+probably means the machine has not been setup using the faxsetup(1M)
+command. Read the documentation on setting up HylaFAX before you
+startup a server system.
+
+EOF
+ exit 1
+}
+. etc/setup.cache
+
+PS=$GSRIP
+
+fil=
+out=pdf.fax # default output filename
+pagewidth=1728 # standard fax width
+pagelength=297 # default to A4
+vres=98 # default to low res
+device=tiffg3 # default to 1D
+while test $# != 0
+do
+ case "$1" in
+ -o) shift; out="$1" ;;
+ -w) shift; pagewidth="$1" ;;
+ -l) shift; pagelength="$1" ;;
+ -r) shift; vres="$1" ;;
+ -m) shift;; # NB: not implemented
+ -1) device=tiffg3 ;;
+ -2) ($PS -h | grep tiffg32d >/dev/null 2>&1) \
+ && { device=tiffg32d; } \
+ || { device=tiffg3; }
+ ;;
+ -*) ;;
+ *) fil="$fil $1" ;;
+ esac
+ shift
+done
+test -z "$fil" && fil="-" # read from stdin
+case "${pagewidth}x${pagelength}" in
+1728x280|1728x279) # 279.4mm is actually correct...
+ paper=letter;;
+1728x364)
+ paper=legal;;
+*x296|*x297) # more roundoff problems...
+ paper=a4;;
+*x364)
+ paper=b4;;
+*)
+ echo "$0: Unsupported page size: $pagewidth x $pagelength";
+ exit 254;; # causes document to be rejected
+esac
+
+#
+# The sed work fixes bug in Windows-generated
+# PostScript that causes certain international
+# character marks to be placed incorrectly.
+#
+# | $SED -e 's/yAscent Ascent def/yAscent 0 def/g' \
+#
+# NB: unfortunately it appears to break valid PostScript;
+# so it's been disabled.
+#
+# Suggestion from "Alan Sparks" <asparks@nss.harris.com>,
+# Add the -DFIXEDMEDIA argument to the last command in ps2fax
+#
+$PS -q \
+ -sDEVICE=$device \
+ -dNOPAUSE \
+ -dSAFER=true \
+ -sPAPERSIZE=$paper \
+ -dFIXEDMEDIA \
+ -dBATCH \
+ -r204x$vres \
+ "-sOutputFile=$out" \
+ $fil