Friday, August 9, 2013

Remove PDF File password (Linux)

To remove the password from the PDF files , we can use script like below.


Shell File Name : removePassWord.sh

File Location: ~/bin/removePassWord.sh

----------------------------------------------CONTENT START----------------------------------------------------------
# Usage removePassWord.sh  
for f in $1/*.pdf
do
echo "Removing password for pdf file - $f"
pdftops -upw $2 "$f" "$f".ps
ps2pdf "$f".ps "$f"
        rm -rf "$f".ps 
done
----------------------------------------------CONTENT ENDS ----------------------------------------------------------

No comments: