Retour

PDF Half page splitting

2009-02-26 12:15:18 (ID: 222, Parent: 0, Type: post)

I’ve found this interresting script digging around.  As I’ve a lot of old book got scanned 2 / 1 pages and I don’t found then easy to read on my portable device I think this could be useful.

#!/bin/bash
#script:    unpnup
#        This script reformats pdf files where two portait pages
#        are joined on one landscape page (like pnup does). After
#        completion each page is on one single fullframe page
#         Copyright (c) 2007 F5 GmbH
# Author: Harald Hackenberg <hackenberggmx.at>
#
#programs required:
#           pdftk, pdftops, poster, epstopdf
#
#
#
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.  See http://www.gnu.org/copyleft/gpl.html for
# the full text of the license.
if [ “$1″ == “” ] || [ “$1″ == “–help” ]; then
echo
echo “Usage: `basename $0` filename”
echo
else

mkdir tmp
cd tmp
pdftk “$1″ burst
for file in pg*.pdf;
do
pdftops -eps $file
poster -v -pA4 -mA5 -c0% `basename $file .pdf`.eps > `basename $file .pdf`.tps
epstopdf `basename $file .pdf`.tps
done
pdftk pg*.pdf cat output ../`basename $1 .pdf`_unpnuped.pdf
rm *
cd ..
rmdir tmp
fi