SuSE GmbH

SuSE Support Database

Title: Printer: Filename in the header / Printing PostScript source code

----------

Mainpage o Searchform o History o Versions o Categories o Contents

----------

Printer: Filename in the header / Printing PostScript source code

Applies to

SuSE Linux: Versions 6.1 to 6.2

Request:

You'd like the file name to be included in the Header when you print a document.

You'd like to print PostScript source code.

Prerequisites:

The apsfilter is configured for your printer.

You can print using the lpr command.

The file /etc/apsfilterrc has one of the following values set:
FEATURE=1, FEATURE=2, or FEATURE=1l

Procedure:

Replace the file /var/lib/apsfilter/filter/ascii with the following:


#
#  Module filter/ascii for apsfilter
#
#  Copyright 1996,99 S.u.S.E. GmbH
#  Author:   Werner Fink  <werner@suse.de>
#
#
#  findfilter () is defined in handler/functions called by apsfilter
#
#  print ascii using a2ps
#
if [ "$USE_RECODE_NOT_A2PS" = "yes" ] ; then
    findfilter recode RECODE
    HAVE_RECODE="$HAVE_RECODE -q latin1:ibmpc"
    print_stdin()
    {
        #
        # recode returns no PostScript but IBM[tm] compatible text
        # Note: this is a special case of RAW printing.
  #
        $DECOMPRESS $HAVE_RECODE | eval $PRINT_RAW
    }
elif [ "$USE_ENSCRIPT" = "yes" ] ; then
    findfilter enscript ENSCRIPT
    print_stdin()
    {
        $DECOMPRESS eval $HAVE_ENSCRIPT ${ENSCRIPT_OPTS} -p - | eval $PRINT_PS
    }
else
    findfilter a2ps A2PS
    ver=v4.3
    set -- `$HAVE_A2PS -V 2>&1 | head -9c`
    test "$1" = "GNU"  -a "$2" = "a2ps" && ver=v4.10

    #
    # For a detailed description of the a2ps commandline options
    # please look up the manpage
    #
    if test "$ver" = v4.10 ; then
        case $PAPERSIZE in
            letter)     A2PS_MEDIUM="--medium=Letter"  ;;
            legal)      A2PS_MEDIUM="--medium=Legal"   ;;
            ledger)     A2PS_MEDIUM="--medium=Ledger"  ;;
            tabloid|11x17)
                        A2PS_MEDIUM="--medium=Tabloid" ;;
            a3)         A2PS_MEDIUM="--medium=A3"      ;;
            a4)         A2PS_MEDIUM="--medium=A4"      ;;
            a5)         A2PS_MEDIUM="--medium=A5"      ;;
            b4)         A2PS_MEDIUM="--medium=B4"      ;;
            b5)         A2PS_MEDIUM="--medium=B5"      ;;
            *)          A2PS_MEDIUM="--medium=$PAPERSIZE"
        esac
    else
        A2PS_MEDIUM="-X$PAPERSIZE"
    fi

    case $PRINTER in
        cdj*|*desk*|djet*|dnj*|paintjet|pj*|hpdj)
            if test "$ver" = v4.10 ; then
                case $PAPERSIZE in
                    letter)     A2PS_MEDIUM="--medium=Letterdj" ;;
                    a4)         A2PS_MEDIUM="--medium=A4dj"     ;;
                esac
            else
                A2PS_MEDIUM="$A2PS_MEDIUM -M1.6"
            fi ;;
        *)
            if test "$ver" != v4.10 ; then
                A2PS_MEDIUM="$A2PS_MEDIUM -M1.4"
            fi ;;
    esac

    #
    # If title is given in cf file then use it
    #
    NAME=${NAME##*/}
    if test "$ver" = "v4.10" ; then
        A2PS_NAME="--title=\"$NAME\" --stdin=Text --center-title=\"$NAME\""
        case "$NAME" in
            *stdin*) A2PS_NAME="--title=stdin --stdin=Text --center-title" ;;
        esac
        [ -n "$TITLE" ] && A2PS_NAME="--title=\"$TITLE\" --stdin=Text --center-ti
    else
        A2PS_NAME="-H\"$NAME\""
        case "$NAME" in
            *stdin*) A2PS_NAME="-H\"\"" ;;
        esac
        [ -n "$TITLE" ] && A2PS_NAME="-H\"$TITLE\""


  fi
    #
    # If full name is given in cf file then use it
    #
    if test "$ver" = "v4.10" ; then
        A2PS_PERSON="--header=\"%A{${PERSON}@${HOST}}\""
        [ -n "$LPERSON" ] && A2PS_PERSON="--header=\"%A{${LPERSON}@${HOST}}\""
    else
        A2PS_PERSON="-Q$PERSON -Z$HOST"
        [ -n "$LPERSON" ] && A2PS_PERSON="-Q\"$LPERSON\" -Z$HOST"
    fi
    #
    if test "$ver" = "v4.10" ; then
        s='$s'
        A2PS_BASIC_OPTIONS="-q --left-footer --right-footer='\$s.' --right-title=
        A2PS_BASIC_OPTIONS="$A2PS_BASIC_OPTIONS --prologue=bw --encoding=latin1 -
    else
        A2PS_BASIC_OPTIONS="-q -8 -nP"
    fi
    A2PS_BASIC_OPTIONS="$A2PS_BASIC_OPTIONS $A2PS_MEDIUM"
    A2PS_BASIC_OPTIONS="$A2PS_BASIC_OPTIONS $A2PS_NAME $A2PS_PERSON"
    #
    if test "$ver" = "v4.10" ; then
        A2PS_STD_OPTIONS="--borders=no --footer --right-footer"
        A2PS_FONTSIZE_BIG="--font-size=9.0"
        A2PS_FONTSIZE_SMALL="--font-size=6.9"
        A2PS_LANDSCAPE="--landscape"
        A2PS_PORTRAIT="--portrait"
        A2PS_NOHEADER="--no-header"
    else
        A2PS_STD_OPTIONS="-r -ns -nu"
        A2PS_FONTSIZE_BIG="-F9.0"
        A2PS_FONTSIZE_SMALL="-F6.9"
        A2PS_LANDSCAPE="-l"
        A2PS_PORTRAIT="-p"
        A2PS_NOHEADER="-nH -nL"
    fi

    # FEATURE: see in /etc/apsfilterrc
    case $FEATURE in
        1)      A2PS_FEATURES="-1 $A2PS_PORTRAIT  $A2PS_FONTSIZE_BIG"            
        2)      A2PS_FEATURES="-2 $A2PS_LANDSCAPE $A2PS_FONTSIZE_SMALL"          
        1n)     A2PS_FEATURES="-1 $A2PS_PORTRAIT  $A2PS_FONTSIZE_BIG   $A2PS_NOHE
        2n)     A2PS_FEATURES="-2 $A2PS_LANDSCAPE $A2PS_FONTSIZE_SMALL $A2PS_NOHE
        1l)     A2PS_FEATURES="-1 $A2PS_LANDSCAPE $A2PS_FONTSIZE_BIG"            
        1ln)    A2PS_FEATURES="-1 $A2PS_LANDSCAPE $A2PS_FONTSIZE_BIG   $A2PS_NOHE
        *)      A2PS_FEATURES="                   $A2PS_FONTSIZE_SMALL $A2PS_NOHE
    esac

    # if no user defined options then take the one we provide
    # if user defined A2PS_OPTS, we have to keep the A2PS_BASIC_OPTIONS !!!

    if [ -z "$A2PS_OPTS" ]; then
        A2PS_OPTS="${A2PS_STD_OPTIONS} ${A2PS_FEATURES}"
    fi
    A2PS_OPTS="${A2PS_BASIC_OPTIONS} ${A2PS_OPTS}"

    print_stdin()
    {
        $DECOMPRESS eval $HAVE_A2PS ${A2PS_OPTS} | eval $PRINT_PS
    }
fi

#
# Declare for export
#
declare -xf print_stdin

#
# End
#

After which the file name should be printed in the Header.

Test this function with the command:

lpr /etc/fstab
PostScript source code shouldn't be a problem either...

Test it with:

lpr -Pascii /var/lib/apsfilter/preloads/margins.ps

----------

Keywords: PRINTER, HEADER, APSFILTER, ASCII, POSTSCRIPT, PS

----------

Categories: Frequently asked Questions , Documentation , Printer

----------

Mainpage o Searchform o History o Versions o Categories o Contents

----------

SDB-jsmeix_print-header, Copyright SuSE GmbH, Nuremberg, Germany - Version: 03. Nov 1999
SuSE GmbH - Last generated: 03. Nov 1999 22:40:39 by wimer with sdb_gen 1.00.0