0

What is a "good" tool to encrypt (password protect) .pdf files? (without being required to buy additional software; the protection can be created under linux but the password query should work on Windows, too)

I know that zip can do it: zip zipfile_name_without_ending -e files_to_encrypt.foo What I don't like about this is that for a single file, you have to use Winzip to open the zip and then click the file again. I rather would like to be prompted for a password when opening the .pdf (single file case). I know that pdftk can do this: pdftk foo.pdf output foo_protected.pdf user_pw mypassword. The problem here is that the password is displayed in the terminal -- even if you use ... user_pw PROMPT. But in the end you get a password-protected .pdf and you are prompted for the password when opening the file.

1 Answer 1

2

You could just wrap pdftk in a script. Something as

#!/bin/bash

filename=$1
base_filename=${filename%pdf}
new_filename=$(echo $base_filename"encrypted.pdf")

read -p 'password:' -s secret; echo
pdftk $filename output $new_filename user_pw $secret

echo ${filename}" encrypted to "${new_filename}

Of course you should add some checking and you could give both input and output file names, etc, but you get the point.

1
  • nice idea, thanks! I still hope for a different solution since pdftk is old and not well maintained anymore (afaik). Jun 21, 2012 at 12:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .