Skip to content

Instantly share code, notes, and snippets.

@prateekrajgautam
Created February 23, 2021 09:19
Show Gist options
  • Save prateekrajgautam/cb13cf006e252f44edf81e2bdb82db25 to your computer and use it in GitHub Desktop.
Save prateekrajgautam/cb13cf006e252f44edf81e2bdb82db25 to your computer and use it in GitHub Desktop.
Encrypt pdf using pdftk
#!/bin/bash
read -p 'Input file name : ' input
read -p 'Input file name : ' output
read -s -p 'Input Secured Password : ' pass
echo ""
echo "trying to fine file in current folder"
pdftk ./$input input_pw encrypt output ./$output.pdf user_pw prateek owner_pw $pass encrypt_128bit compress flatten
echo ""
echo "trying to find file in absolute path"
pdftk "$input" input_pw encrypt output "$output.pdf" user_pw prateek owner_pw $pass encrypt_128bit compress flatten
echo ""
read -p 'press enter to: '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment