pdf2fax.gs.sh.in
上传用户:weiyuanprp
上传日期:2020-05-20
资源大小:1169k
文件大小:3k
源码类别:

传真(Fax)编程

开发平台:

C/C++

  1. #! @SCRIPT_SH@
  2. # $Id: pdf2fax.gs.sh.in,v 1.6 2008/01/09 06:40:35 faxguy Exp $
  3. #
  4. # HylaFAX Facsimile Software
  5. #
  6. # Copyright (c) 1990-1996 Sam Leffler
  7. # Copyright (c) 1991-1996 Silicon Graphics, Inc.
  8. # HylaFAX is a trademark of Silicon Graphics
  9. # Permission to use, copy, modify, distribute, and sell this software and 
  10. # its documentation for any purpose is hereby granted without fee, provided
  11. # that (i) the above copyright notices and this permission notice appear in
  12. # all copies of the software and related documentation, and (ii) the names of
  13. # Sam Leffler and Silicon Graphics may not be used in any advertising or
  14. # publicity relating to the software without the specific, prior written
  15. # permission of Sam Leffler and Silicon Graphics.
  16. # THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  17. # EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  18. # WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  19. # IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  20. # ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  21. # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  22. # WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  23. # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  24. # OF THIS SOFTWARE.
  25. #
  26. #
  27. # Convert PDF to facsimile using Ghostscript.
  28. #
  29. # pdf2fax [-o output] [-l pagelength] [-w pagewidth]
  30. # [-r resolution] [-m maxpages] [-*] [file ...]
  31. #
  32. # We need to process the arguments to extract the input
  33. # files so that we can prepend a prologue file that sets
  34. # up a non-interactive environment.
  35. #
  36. # NB: this shell script is assumed to be run from the
  37. #     top of the spooling hierarchy -- s.t. the etc directory
  38. #     is present.
  39. #
  40. test -f etc/setup.cache || {
  41.     SPOOL=`pwd`
  42.     cat<<EOF
  43. FATAL ERROR: $SPOOL/etc/setup.cache is missing!
  44. The file $SPOOL/etc/setup.cache is not present.  This
  45. probably means the machine has not been setup using the faxsetup(@MANNUM1_8@)
  46. command.  Read the documentation on setting up HylaFAX before you
  47. startup a server system.
  48. EOF
  49.     exit 1
  50. }
  51. . etc/setup.cache
  52. . bin/common-functions
  53. PS=$GSRIP
  54. jobid=
  55. files=
  56. out=pdf.fax # default output filename
  57. pagewidth=1728 # standard fax width
  58. pagelength=297 # default to A4 
  59. vres=98 # default to low res
  60. device=tiffg3 # default to 1D
  61. unlimitedlength=no # default to fixed length-pages
  62. while test $# != 0
  63. do
  64.     case "$1" in
  65.     -i) shift; jobid="$1" ;;
  66.     -o) shift; out="$1" ;;
  67.     -w) shift; pagewidth="$1" ;;
  68.     -l) shift; pagelength="$1" ;;
  69.     -r) shift; vres="$1" ;;
  70.     -m) shift;; # NB: not implemented
  71.     -U) unlimitedlength=yes ;;
  72.     -1) device=tiffg3 ;;
  73.     -2) ($PS -h | grep tiffg32d >/dev/null 2>&1) 
  74.     && { device=tiffg32d; } 
  75.     || { device=tiffg3; }
  76. ;;
  77.     -3) ($PS -h | grep tiffg4 >/dev/null 2>&1) 
  78.     && { device=tiffg4; } 
  79.     || { device=tiffg3; }
  80. ;;
  81.     -*) ;;
  82.     *) files="$files $1" ;;
  83.     esac
  84.     shift
  85. done
  86. gs2fax pdf
  87. exit 0