Skip to Content.
Sympa Menu

baslinux - Re: [BL] double sided printing script

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: sindi keesan <keesan AT sdf.lonestar.org>
  • To: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] double sided printing script
  • Date: Wed, 22 Mar 2006 02:54:39 +0000 (UTC)


Looking for a way to print double sided with netpbm's pbmtolj or gs.

All suggestions welcome, even if they require gs or xpdf to print.

Sindi

Several ways to print double-sided in linux, none of which I want to use:

gimp_print_cups - big X11 image viewer
gv - ghostview, needs to be compiled, X11
mpage - for printing text as ps on a ps printer (you can print 8 pages on 1 page, or just odd or just even pages)
libppd and a new lpr (requires a ps printer or ghostscript)

In the Linux Ecology HOWTO I found a link to 'duplex', a set of shell scripts for printing postscript, below. I think it uses gs, lpr, and printcap (add a couple of lines to do odd and even printing).

I am hoping for something much simpler, to use with pbmtolj.

The 'ecology' people are trying to save trees and space. This script uses plenty of space. They are debating whether to use LCD monitors because they come in less packing but use more toxic materials, and whether to use smaller monitors to save materials and energy, but they might cause more people to print out things they can't view as clearly.

dplx script for Deskjet

#!/bin/sh
###################################################
## dplx v0.1 ##
## Emulates duplex printing for dedicated HP ##
## Deskjet printer on a workstation ##
## Calling sequence: ##
## dplx [-opt "<lp common parameter list>"] ##
## [<print-file>|<->] ##
## ##
## Copyright (c) 02 May 2004 Joseph J. Pollock ##
## JPmicrosystems - josephj at main.nc.us ##
[stuff on GNU license omitted here]

function max() {
# max - return the maximum of an arbitrary list of
# unsigned 8-bit numeric arguments
# nonnumerics and nulls treated as 0
local i rc
typeset -i i rc

rc=0
for i in $*
do
if [ "$i" -gt "$rc" ]
then
rc=$i
fi
done

return $rc
}

name=$(basename $0) # path stripped name of this script
usage="$name [-opt \"<lp common parameter list>\"] [<print-file>|<->]"

namlen=${#name} # string length of name
nl=$(( $namlen+18 )) # Length of script name
# + room for infobox title line
uselen=${#usage} # string length of usage
dsptime=20000 # Miliseconds to display error messages
xdopt="--title $name --auto-placement" # Xdialog common options
if [ "$1" = "--help" ] # if first argument is --help
then # then echo a usage message
echo "$name: usage is $usage" # and exit
exit 0
fi

e="" # Null string so duplex is called
# e="echo " #For debugging - disable call to duplex
duplex="duplex" # Production version
##duplex="/home/bigbird/pgm/duplex_proj/duplex.0.7" # Test version
# put your lp options for printing each side here
pass1="-o page-set=odd -o outputorder=reverse"
pass2="-o page-set=even -o outputorder=normal"

if [ "$1" = "-opt" ] # check for optional common parameters flag
then
shift

if [ -z "$1" ] # if flag was found, then parameters
then # are mandatory
Xdialog $xdopt --backtitle "Usage Error" --infobox "Usage is\n\n
$usage\n\n
Aborting..." 12 $uselen $dsptime

exit 1
else # common parameters found
pass1="$1 $pass1"
pass2="$1 $pass2"
# echo "pass1 [$pass1]" # for debugging
# echo "pass2 [$pass2]"
shift
fi
fi

if [ -z "$1" ] || [ "$1" = "-" ] # If no file argument, then # use "-" for stdin
f="-"
else # otherwise, use file argument
f=$1
if [ ! -e "$f" ] # if the file does not exist
then
fl=$(( ${#f}+13 )) # Length of file name + message text
max $fl $nl
len=$?

Xdialog $xdopt --infobox "[$f] Not found\n\n Aborting..."\
8 $len $dsptime

exit 1
fi
fi

# if e is null, call duplex
# otherwise e="echo" - echo the calling sequence for debugging
$e $duplex "$pass1" "$pass2" "$f"

exit $? # return the status returned by duplex




Archive powered by MHonArc 2.6.24.

Top of Page