Michael Loßin on Wed, 26 Dec 2001 20:50:40 +0100 (CET)(envelope-from owner-apsfilter-help@apsfilter.org)


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

RE: can't get hardware-duplex to work


On 26-Dec-01 Camille Dominique wrote:
> Hi, 
> Since I've been using the 7.x versions of apsfilter, I haven't been
> able
> to get duplex printing to work anymore.
> 
> I'm printing over the network to an HPLaserJet 5M postscript with a
> duplex unit, and it used to work before with the 6.1x version of
> apsfilter.

Hi Camille!

You have just discovered the fact that none of the developers
have a true PostScript printer to test that stuff -- which is
possibly the reason they use apsfilter themselves :^)

> I did an aps2file -D, and there is a spot where it says "unset
> DUPLEX" ?

What?! You are actually doing a bug report the way it's supposed
to be? You must be crazy...

> **** and this is what aps2file -D gave me 
[...]
> ++ DUPLEX=set

At least the setting comes through.

[...]
> + DRIVER_SCRIPT=PS
> + '[' '!' -e /usr/local/etc/apsfilter/basedir/driver/PS ']'
> + '[' -z PS ']'
> + '[' -e /usr/local/etc/apsfilter/basedir/driver/PS ']'
> + . /usr/local/etc/apsfilter/basedir/driver/PS
> + '[' '' ']'
> + '[' set ']'
> + unset DUPLEX
> 
> 
> ^^^^^^^^^^^^^^ is this normal ?

This is the critical place... We don't to any ghostscript
option processing here (and why should we for a PS printer),
but we erroneously expect the driver script to do the
right thing for duplex (and copies)... Seems we're a victim
of our own logic here :)

[...]
> +++ ps_set_duplex
> +++ local tumble duplex
> +++ '[' long = short ']'
> +++ tumble=false
> +++ '[' '' ']'
> +++ duplex=false
> 
> 
> ^^^^^^^^^^^^^^^^^ and this here ?

This is just a consequence of the error above.

> thanks for any hint,

First of all, thank you for that bug report (if only
everyone would do it like this...).


I tested this fix via aps2file (no real duplex printer
available), so please notify us if it doesn't work as
expected...

Two changes are needed in bin/apsfilter (if you have the
latest version, it's bin/apsfilter.in):

1) the top of print_ps() (around line 1085) must look
like this:

print_ps()
{
    local paper gs_cmd

    if [ "$DUPLEX" ] && \
       [ "$PRINTER" != PS -o -z "$HARDWARE_DUPLEX" ]; then
        unset DUPLEX
        print_ps_duplex
        return
    elif [ "$PRINTER" = PS ]; then
        ps_postprocessing | print_data
        return
    fi

    find_filter gs || fatal_filter gs

[...etc...]


2) at the end of the script, two lines have to be
protected from being used along with the PS driver:

# if the driver does copying/duplex by itself, we won't do it anymore
# (hopefully the correct options have been added in the printer script)
if [ "$PRINTER" != PS ]; then
    [ "$HARDWARE_COPIES" ] && COPIES=1
    [ "$HARDWARE_DUPLEX" ] && unset DUPLEX
fi


I hope you are able to apply this fix by yourself; the next
release should already contain it, hopefully... :)
Right now, I'm too busy introducing other bugs.


HTH
Michael