Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to remove some stupid email watermark that expands across all pages of a public domain book. I looked at pdftk man page and some examples but still can not figure out how to remove the watermarks. I appreciate your hints.

share|improve this question

migrated from stackoverflow.com Jul 13 '12 at 14:53

This question came from our site for professional and enthusiast programmers.

I'm willing to bet it can't be done... –  Jaitsu Jul 12 '12 at 12:34
I'm willing to bet it can be done. But most likely not with pdftk... (But to proof it, one would need access to the file. It's in the public domain, is it?!?) –  Kurt Pfeifle Jul 12 '12 at 12:55
Here you go Kurt: 2shared.com/document/76HGQ4yk/book01.html it is an old history book. –  hnns Jul 12 '12 at 13:32

2 Answers 2

up vote 15 down vote accepted

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

share|improve this answer
Fantastic! worked like a charm. please just rename the email address to a fictitious one. I don't want the guy how spoiled the book be targeted by spammers. Specially as he is probably the one who has made the pdf. Many thanks. –  hnns Jul 12 '12 at 14:17
done! Changed specific string with a generic string –  Dingo Jul 12 '12 at 14:28
Does anyone know how to modify this solution to get rid of a link watermark? I got rid of the text, but there's still a small square left where the text used to be. –  425nesp Oct 20 '13 at 7:43
when I do this sed -e "s/unwanted-text /g" <input.pdf> unwatermarked.pdf I get error sed: couldn't open file unwanted-text/ /g: No such file or directory my string is a web link –  Registered User Oct 28 '13 at 11:40
Ok I have been able to get it this is very very good many thanks for sharing this method –  Registered User Oct 28 '13 at 11:52

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
share|improve this answer
You are a life-saver! Thank you!!! :) –  johndodo Nov 7 '13 at 11:11
This is really awesome! –  qed Jan 29 '14 at 14:59
I took this process, made it slightly fancier, and wrapped it up in a Python script. It is on github here. –  Alexander Garden Apr 11 '14 at 4:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.