How to remove watermark from pdf using pdftk?
Just a little add-on to Dingo's answer as it did not work for me:
I had to first uncompress the PDF document in order to be able to find the watermark and replace it with sed
.
The first step involves uncompressing the PDF document using pdftk
:
pdftk original.pdf output uncompressed.pdf uncompress
now, the uncompressed.pdf
can be used as in Dingo's answer:
sed -e "s/watermarktextstring/ /" uncompressed.pdf > unwatermarked.pdf
I then repaired and recompressed the document:
pdftk unwatermarked.pdf output fixed.pdf compress
very simply task to perform:
use sed:
sed -e "s/watermarktextstring/ /g" <input.pdf >unwatermarked.pdf
but, after, be sure to repair resulting output pdf
pdftk unwatermarked.pdf output fixed.pdf && mv fixed.pdf unwatermarked.pdf
all into one command:
sed -e "s/watermarktextstring/ /g" <input.pdf >unwatermarked.pdf && pdftk unwatermarked.pdf output fixed.pdf && mv fixed.pdf unwatermarked.pdf
text watermarks are nothing else than a text between two tags inside the pdf compressed code