Rotating all the odd pages in a PDF document

A document has been scanned, badly. All the odd pages are the wrong way round (by 180 degrees).

How to fix it?

pdftk A=[name of input PDF.pdf] shuffle AoddSouth AevenNorth output [name of output.pdf]

Reverse it if the even pages are wrong:

pdftk A=[name of input PDF.pdf] shuffle AevenSouth AoddNorth output [name of output.pdf]

If it is really messed up, and the pages are just 90 degrees out, substitute “East” or “West” for “South”, according to the rotation.