Pdftk: edit PDF file in-place

pdf

Using PDFtk Server, I want to rotate a PDF file 90˚ and save it in-place, to overwrite the input file. I tried the following, but it fails, probably because it starts writing before the file is finished reading.

pdftk in.pdf cat 1-endright output - > in.pdf

Best Answer

in your operation bash overwrite in.pdf file before call pdftk. You can't do it that way. I would recommend something like

pdftk in.pdf cat 1-endright output in-new.pdf && mv in-new.pdf in.pdf

This command also protect you when converting fail - file would not be overwriten.