For this recipe we need ghostscript which is/should be installed by default, as well as pdftk and xpdf-utils:
apt-get install pdftk sudo apt-get install xpdf-utils
If the PDF is encrypted with a password, remove it using xpdf-utils and ghostscript:
pdftops -upw PASSWORD encrypted.pdf ps2pdf encrypted.ps plaintext.pdf
Now remove the watermark with sed and repair it with pdftk, assuming the file name is plaintext.pdf
sed -e "s/THISISTHEWATERMARK/ /g" <plaintext.pdf >nowatermark.pdf && pdftk nowatermark.pdf output repaired.pdf && mv repaired.pdf nowatermark.pdf
Resulting in the finalĀ nowatermark.pdf without encryption or watermark
3 Responses to Remove password and watermark from pdf on Ubuntu 14