| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# Copyright (c) 2009 - Jan Girlich <[email protected]>, Luca Invernizzi <[email protected]> |
| 4 |
# |
| 5 |
# This program is free software: you can redistribute it and/or modify it under |
| 6 |
# the terms of the GNU General Public License as published by the Free Software |
| 7 |
# Foundation, either version 3 of the License, or (at your option) any later |
| 8 |
# version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, but WITHOUT |
| 11 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 12 |
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 13 |
# details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License along with |
| 16 |
# this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
# |
| 18 |
# Script to create a pocketmod form a latex source file |
| 19 |
# |
| 20 |
# Note that the GTG export plugin passes the script the path of the source file |
| 21 |
# and expects to be given the path of the generated file in the standard output |
| 22 |
|
| 23 |
TMPFOLDER=`mktemp -d /tmp/pocketmod.XXXXXXXXXX` |
| 24 |
OUTFILE=`mktemp /tmp/pockemod.XXXXXXXXXXXXX`.pdf |
| •25 |
SOURCEFILE="$1" |
| 26 |
pdflatex -interaction nonstopmode -output-directory $TMPFOLDER -jobname temp "$SOURCEFILE" 1>&2 |
| 27 |
PDFFILE=$TMPFOLDER/temp.pdf |
| 28 |
pdftk $PDFFILE cat 6 7 8 1 output $TMPFOLDER/seite6781.pdf 1>&2 |
| 29 |
pdftk $PDFFILE cat 5 4 3 2 output $TMPFOLDER/seite5432.pdf 1>&2 |
| 30 |
pdfjam --angle 90 $TMPFOLDER/seite5432.pdf --outfile $TMPFOLDER/seite5432-r.pdf 1>&2 |
| 31 |
pdfjam --angle 90 $TMPFOLDER/seite5432-r.pdf --outfile $TMPFOLDER/seite5432-r2.pdf 1>&2 |
| 32 |
pdftk $TMPFOLDER/seite6781.pdf $TMPFOLDER/seite5432-r2.pdf cat output $TMPFOLDER/gesamt.pdf 1>&2 |
| 33 |
pdfjam $TMPFOLDER/gesamt.pdf --nup 4x2 --landscape --outfile $OUTFILE 1>&2 |
| 34 |
rm -rf $TMPFOLDER 1>&2 |
| 35 |
echo -n $OUTFILE |