Ajout des outils gpdftk et pdf180.
[progfou.git] / outils / pdf180
... / ...
CommitLineData
1#!/bin/bash
2# un outil de rotation de PDF compatible Evince... au prix de perte de qualité
3if [ -z "$1" -o ! -f "$1" ]; then
4 echo "Usage: $0 input.pdf [output.pdf]"
5 exit 1
6fi
7IN="$1"
8[ "$2" ] && OUT="$2" || OUT="`echo "$1" | sed 's/\.pdf$/-180.pdf/'`"
9DIR=`mktemp -d`
10pdfimages "$IN" "$DIR"/img
11for f in "$DIR"/img-*.pbm ; do
12 convert "$f" -negate -rotate 180 pnm:- |
13 pnmtops -noturn 2>/dev/null |
14 ps2pdf - "${f%.pbm}.pdf"
15done
16pdfjoin --outfile "$OUT" "$DIR"/img-*.pdf >/dev/null
17rm -rf "$DIR"