How do you programmatically - or from CLI - rotate a PDF?

view story

http://stackoverflow.com – What I need to be able to do is to rotate a PDF clockwise or counter clockwise either programmatically or from the CLI. I have spent considerable time researching and attempting to rotate PDFs with GhostScript (as GS is already installed for other reasons) to no avail, nothing seems result in any rotation. I have looked into using pdftk but it requires java libraries, and I would rather not have java installed on the system. We've even looked at modifying the PDF file ourselves, and we have had some success with this, but we haven't come across a reliable method that works for all PDFs. (HowTos)