![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
|
General Help All your general support questions for Ubuntu, Kubuntu, Edubuntu and Xubuntu. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
A Carafe of Ubuntu
![]() Join Date: Jan 2007
My beans are hidden!
|
pdftk usage question
Sometimes when the librarians scan papers/books to send me, they get the orientation wrong and all of the even pages need to be rotated 180 degrees. I can rotate all of those pages using pdftk
Code:
pdftk in.pdf cat 1-endevenS output out.pdf Using this just gives me the all the rotated even pages first, then the odd pages: Code:
pdftk in.pdf cat 2-endevenS 1-endodd output out.pdf |
|
|
|
|
|
#2 |
|
First Cup of Ubuntu
![]() Join Date: Jan 2008
Beans: 2
|
Re: pdftk usage question
Use the following shell script. Save it as pdf-rotate-even and make it executable.
Code:
#/bin/bash
# script for rotating all even pages of a document
# enough arguments?
if [ $# -ne 2 ]; then
echo 1>&2 Usage: pdf-rotate-even input.pdf output.pdf
exit 127
fi
# generate a temporary directory
TEMPDIR=/tmp/pdf`date +%N`
mkdir $TEMPDIR
# rotate all even pages, keep the odd ones
pdftk $1 cat 1-endodd output $TEMPDIR/odd.pdf
pdftk $1 cat 1-endevenS output $TEMPDIR/even.pdf
# split the files...
pdftk $TEMPDIR/odd.pdf burst output $TEMPDIR/pg%04d_A.pdf
pdftk $TEMPDIR/even.pdf burst output $TEMPDIR/pg%04d_B.pdf
# ... and recombine them, "_A" and "_B" suffixes leading to the correct order
pdftk $TEMPDIR/pg*.pdf cat output $2
# cleanup
rm -r $TEMPDIR
|
|
|
|
|
|
#3 |
|
First Cup of Ubuntu
![]() Join Date: Sep 2009
Beans: 1
|
Re: pdftk usage question
Thanks for the script, I had the same problem.
I suggest du use evenD instead of evenS since it will rotate relatively by 180 degrees. |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|