Brett Klamer

Remove PDF Watermarks

Remove pdf watermarks using sed and pdftk.

# Uncompress the pdf
pdftk infile.pdf output outfile.pdf uncompress

# Delete the first page
pdftk infile.pdf cat 2-end output outfile.pdf

# Delete the text 'foo'. Escape special characters with '\'.
sed -e "s/foo/ /" infile.pdf > outfile.pdf

# Delete links (don't modify the string)
sed -e "s/\/URI/ /" infile.pdf > outfile.pdf
sed -e "s/\/Link/ /" infile.pdf > outfile.pdf

# Compress the pdf
pdftk infile.pdf output outfile.pdf compress