pr-pamphlet 432 B

123456789101112131415161718192021222324252627
  1. #!/bin/sh
  2. if [ "$#" -lt "2"]; then
  3. APPNAME=$(basename $0)
  4. echo "USAGE: $APPNAME [input-file]"
  5. exit 1
  6. fi
  7. if [[ "$1" = http* ]]; then
  8. FILE=$(mktemp)
  9. curl $1 >$FILE
  10. else
  11. FILE="$1"
  12. fi
  13. if [[ $FILE = *pdf ]]; then
  14. TMPF=$(mktemp)
  15. pdf2ps $FILE $TMPF
  16. elif [[ $FILE = *ps ]]; then
  17. TMPF=$FILE
  18. else
  19. echo "Unknown file type: $FILE"
  20. exit 2
  21. fi
  22. cat $TMPF | psbook | psnup -pletter -2 | lpr -o sides=two-sided-short-edge -P hp4200n