Problem with 'pdftops' filter
Julien Bossert
anonymous at nowhere.com
Tue May 10 10:04:19 PDT 2005
I'll try your 'mypdftops' script as soon I'll have time: maybe switching to gs we'll solve my shifting problem...
Kevin:
>
> Here are two short skripts that might help you either debugging or
> might even solve your problems as is.
>
> 1. a short skript which you can use to switch between cups-pdftops,
> gs-pdf2ps and acroread (Adobe reader). In each of them I tried to
> force A4 paper with options. If you use mypdftops in /etc/cups/mime.convs,
> you can choose between "-o pdf=acro", "-o pdf=gs" or "-o pdf=cups" [default].
>
> #!/bin/bash
> # /usr/lib/cups/filter/mypdftops
> # There are three methods of converting PDF to PS:
> # cups=pdftops, acro, gs=pdf2ps.
> # I have never seen 5 arguments used. (tested: lpr < t.pdf, lpr t.pdf)
> case $# in
> 5|6 ) ;;
> * ) echo "Usage: $0 job-id user title copies options [filename]"; exit ;;
> esac
> DEBUG=0
> # LOGDIR must be writable by user lp (only needed when DEBUG not set to 0)!
> LOGDIR=/var/log/cups
> acrobin="/usr/X11R6/bin/acroread"
> acroopt="-toPostScript -size a4"
> cupsbin="/usr/lib/cups/filter/pdftops"
> gsbin="/opt/ghostscript/bin/gs"
> gsopt="-q -dLanguageLevel=2 -dNOPAUSE -dBATCH -dPARANOIDSAFER -sDEVICE=pswrite"
> gsopt="$gsopt -sPAPERSIZE=a4 -sOutputFile=-"
> if [ $DEBUG -ne 0 ]; then
> time=$(unset TZ;LC_TIME=de_DE date)
> log="$1 $0 $time \$#=$#\nuser: $2\ttitle: $3"
> [ "$4" -ne "1" ] && log="$log\ncopies: $4"
> [ "$5" != "" ] && log="$log\noptions: $5"
> [ "$#" -eq "6" ] && log="$log\nfilename: $6"
> echo -e "$log\n" >> $LOGDIR/cups.parameter
> fi
> case "$5" in
> *acro* )
> $acrobin $acroopt < "$6"
> ;;
> *pdf=gs* | *pdf=pdf2ps* )
> $gsbin $gsopt -f "$6"
> ;;
> * | *pdf=cups* | *pdf=xpdf* | *pdf=pdftops* )
> $cupsbin "$@"
> ;;
> esac
>
> 2. a short skript for page-rearranging (use mypstops in mime.convs),
> use a newly defined "-o book" option.
> If you need the mpage for some kind of page resorting, we have something
> similar using the psbook tool from the psutils package:
>
> #!/bin/bash
> # /usr/lib/cups/filter/mypstops
> # Cups filter which accepts option "book" and resorts output if supplied.
> case $# in
> 5|6 ) ;;
> * ) echo "Usage: $0 job-id user title copies options [filename]"; exit ;;
> esac
> DEBUG=0
> # LOGDIR must be writable by user lp (only if DEBUG not set to 0)!
> LOGDIR=/var/log/cups
> psbook=/usr/bin/psbook
> pstops=/usr/lib/cups/filter/pstops
> case "$5" in
> *book* ) book=y ;;
> * ) book=n ;;
> esac
> # 2003-07-18 ki problems with some PS-files when LANG is set :-(
> unset LANG LANGUAGE LC_ALL
> if [ "$DEBUG" -ne 0 ]; then
> time=$(unset TZ;LC_TIME=de_DE date)
> log="$1 $0 $time \$#=$#\nuser: $2\ttitle: $3"
> [ "$4" -ne "1" ] && log="$log\ncopies: $4"
> [ "$5" != "" ] && log="$log\noptions: $5"
> [ "$#" -eq "6" ] && log="$log\nfilename: $6"
> echo -e "$log\n" >> $LOGDIR/cups.parameter
> fi
> #cat > $LOGDIR/cups.out
> if [ "$book" == "n" ]; then
> $pstops "$@"
> else
> case $# in
> 5 ) $psbook -q | $pstops "$@" ;;
> 6 ) $psbook -q "$6" | $pstops "$1" "$2" "$3" "$4" "$5" ;;
> esac
> fi
>
> Perhaps these simple skripts can help you getting around your
> problem. Or fit them to do more debugging and you will probably
> be able to find the cause of your problem.
>
> Kevin
> --
> _ | Kevin Ivory | Tel: +49-551-3700000
> |_ |\ | | Service Network GmbH | Fax: +49-551-3700009
> ._|ER | \|ET | Bahnhofsallee 1b | mailto:Ivory at SerNet.de
> Service Network | 37081 Goettingen | http://www.SerNet.de/
More information about the cups
mailing list