Results 1 to 3 of 3

Thread: Rotate multiple PDF files

  1. #1
    Join Date
    Jul 2006
    Beans
    209
    Distro
    Ubuntu 10.04 Lucid Lynx

    Rotate multiple PDF files

    How would one go about rotating 180 degrees multiple pdf's in say some folder /home/user/docs/

    I know that I can rotate each page 180 degrees of one pdf as such:
    Code:
    pdftk input.pdf cat 1-endS output output.pdf
    Is there a way in command line to do this for every pdf found in some folder say /home/user/docs/ ?

    As it seems, I have many, many pdf files that need to be rotated and it would take way too long to correct one by one.

    Thanks.
    LIM 1/n = Knowledge of Man
    n → ∞

    My Blog: www.ColdOwl.com

  2. #2
    Join Date
    Apr 2009
    Location
    Tallahassee, FL
    Beans
    24
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: Rotate multiple PDF files

    Do it with a for-loop (in bash):
    Code:
    for i in *.pdf; do pdftk $i cat 1-endS output rot_${i}; done
    This will rotate all pdf-files (for example input1.pdf, input2.pdf, ...) in the current directory and save them to files with the original filenames prefixed with "rot_" (rot_input1.pdf, rot_input2.pdf, ...)

  3. #3
    Join Date
    Jul 2006
    Beans
    209
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Rotate multiple PDF files

    Quote Originally Posted by ostrm View Post
    Do it with a for-loop (in bash):
    Code:
    for i in *.pdf; do pdftk $i cat 1-endS output rot_${i}; done
    This will rotate all pdf-files (for example input1.pdf, input2.pdf, ...) in the current directory and save them to files with the original filenames prefixed with "rot_" (rot_input1.pdf, rot_input2.pdf, ...)

    Thanks

    This isn't exactly related to my issue but would anyone know a tutorial on how to do for loops, if statements, etc. in CLI?
    LIM 1/n = Knowledge of Man
    n → ∞

    My Blog: www.ColdOwl.com

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •