Beat Rubischon on Fri, 25 Aug 2000 14:17:22 +0200 (CEST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

apsfilter 6.0-devel: more options for -Z


Hello!

The last few years, we used for our students cluster plp with a
custom filterscript. Our users loves the following options:

lpr -Z[duplex,|longbind,|shortbind,][2up,][book,][<tray>]

I'm currently migrating from Solaris to Linux, from plp to LPRng
and from "stupid" filters to apsfilter.

The attached patch against apsfilter-current-23.08.2000.tar.bz2
enables those options by using psutils. The tray-selection is
done by a short script located in contrib/pstray/pstray.

Feel free to incorporate this patch in the current development.

Greetings Beat

-- 
Beat Rubischon				<rubischon@phys.ethz.ch>
Informatiksupport			phone:      01/633 41 89
Departement Physik, ETH Zuerich		mobile:    079/347 27 03
diff -r -u --new-file apsfilter.orig/bin/apsfilter apsfilter/bin/apsfilter
--- apsfilter.orig/bin/apsfilter	Mon Aug 21 19:55:40 2000
+++ apsfilter/bin/apsfilter	Fri Aug 25 14:07:04 2000
@@ -856,7 +856,9 @@
 
     case "$PRINTER" in
 	PS_*dpi)
-	    print_data "$@" ${PS_UTILS:+| '$PS_UTILS'}
+	    print_data "$@" ${PS_UTILS:+| '$PS_UTILS'} \
+		${PS_BOOK:+| '$PS_BOOK'} ${PS_NUP:+| '$PS_NUP'} \
+		${PS_DUPLEX:+| '$PS_DUPLEX'} ${PS_DRAWER:+| '$PS_DRAWER'}
 	    return
 	    ;;
     esac
@@ -875,6 +877,8 @@
     eval "$@" | case "$PRINTER" in
 	*.upp)
 	    print_data ${PS_UTILS:+'$PS_UTILS' |} \
+		${PS_BOOK:+'$PS_BOOK' |} ${PS_NUP:+'$PS_NUP' |} \
+		${PS_DUPLEX:+'$PS_DUPLEX' |} ${PS_DRAWER:+'$PS_DRAWER' |} \
 		       gs \
 		       -q \
 		       @'"$PRINTER"' \
@@ -887,6 +891,8 @@
 	    ;;
 	*)
 	    print_data ${PS_UTILS:+'$PS_UTILS' |} \
+		${PS_BOOK:+'$PS_BOOK' |} ${PS_NUP:+'$PS_NUP' |} \
+		${PS_DUPLEX:+'$PS_DUPLEX' |} ${PS_DRAWER:+'$PS_DRAWER' |} \
 		       gs \
 		       -q \
 		       -sDEVICE='"$PRINTER"' \
@@ -1538,6 +1544,32 @@
 	# force file to be treated as ASCII file
 	METHOD=ascii
 	;;
+
+      book)
+	PS_BOOK="psbook -q"
+	PS_NUP="psnup -q -2"
+	PS_DUPLEX="psset -t"
+        ;;
+      1up)
+	unset PS_NUP
+        ;;
+      2up)
+	PS_NUP="psnup -q -2"
+        ;;
+      simplex)
+	unset PS_DUPLEX
+        ;;
+      duplex)
+	PS_DUPLEX="psset -d"
+        ;;
+      longbind)
+	PS_DUPLEX="psset -d"
+        ;;
+      shortbind)
+	PS_DUPLEX="psset -t"
+        ;;
+      0|1|2|3|4|5|6|7|8|9)
+	PS_DRAWER="pstray $option"
     esac
   done
   unset option
diff -r -u --new-file apsfilter.orig/contrib/pstray/README apsfilter/contrib/pstray/README
--- apsfilter.orig/contrib/pstray/README	Thu Jan  1 01:00:00 1970
+++ apsfilter/contrib/pstray/README	Fri Aug 25 14:08:17 2000
@@ -0,0 +1,6 @@
+pstray
+------
+
+This filter is used to insert a tray selection in a postsript file.
+
+8.2k Beat Rubischon <rubischon@phys.ethz.ch>
diff -r -u --new-file apsfilter.orig/contrib/pstray/pstray apsfilter/contrib/pstray/pstray
--- apsfilter.orig/contrib/pstray/pstray	Thu Jan  1 01:00:00 1970
+++ apsfilter/contrib/pstray/pstray	Fri Aug 25 14:07:23 2000
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+#
+# Select papertray and set them an the right place
+#
+# 8.2k Beat Rubischon <beat@rubis.ch>
+#
+my $tray=shift;
+
+if ($tray eq "") {
+    print STDERR "pstray [0|1|2|3|4|...]\n";
+    print STDERR " -> insterts some magic into the postscript stream\n";
+    print STDERR "    to select the chosen tray.\n";
+    exit 1;
+}
+
+while (<>) {
+    if (m/^\%\%EndProlog\s*$/) {   # Prolog zu Ende?
+        print;      # Zeile wieder ausgeben
+        print "%%BeginSetup\n";
+        print "statusdict begin\n";
+        print $tray." setpapertray\n";
+        print "end\n";
+        print "%%EndSetup\n";
+    } else {
+        print;      # Zeile wieder ausgeben
+    }
+}