0

I have a multiple-pages PDF which I would like to split (each page being split in 2 or 3 pages) and rotated.

My aim is to be able to print a scaled version of my PDF.

I tried this

pdftk input.pdf cat 1-endeast output output.pdf 

But it only do a rotation.

1 Answers1

1

Taking this answer as starting point

  1. Split and extract informations from the multipage
pdftk input.pdf burst
  1. Split each page
pw=$(cat doc_data.txt  | grep PageMediaDimensions | head -1 | awk '{print $2}')
ph=$(cat doc_data.txt  | grep PageMediaDimensions | head -1 | awk '{print $3}')
hph=$(( ph / 2 ))
wpx=$(( pw*10 ))
hpx=$((  hph*10 ))
for f in  pg_[0-9]*.pdf ; do
 tf=top_$f
 bf=bottom_$f
 gs -o ${bf} -sDEVICE=pdfwrite -g${wpx}x${hpx} -c "<</PageOffset [0 0]>> setpagedevice" -f ${f}
 gs -o ${tf} -sDEVICE=pdfwrite -g${wpx}x${hpx} -c "<</PageOffset [0 -${hph}]>> setpagedevice" -f ${f}
done
  1. Join
pdftk top_pg_0001.pdf bottom_pg_0001.pdf top_pg_0002.pdf bottom_pg_0002.pdf ... cat output output.pdf
  1. Rotate
pdftk output.pdf cat 1-endeast output outputRotated.pdf