39

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.

0

3 Answers 3

39

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

6
  • 1
    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, 2012 at 14:17
  • done! Changed specific string with a generic string
    – Dingo
    Jul 12, 2012 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, 2013 at 7:43
  • pdftk crashed when I ran this.
    – Cerin
    Sep 3, 2018 at 11:28
  • @Dingo how do batch process it? I mean multiple files Nov 20, 2018 at 13:11
67

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
12
  • You are a life-saver! Thank you!!! :)
    – johndodo
    Nov 7, 2013 at 11:11
  • 1
    This is really awesome!
    – qed
    Jan 29, 2014 at 14:59
  • 4
    I took this process, made it slightly fancier, and wrapped it up in a Python script. It is on github here. Apr 11, 2014 at 4:00
  • @Alexander Garden It doesn't work, TypeError: str() takes at most 1 argument (2 given) when used following the usage advice given
    – 8bitjunkie
    Feb 28, 2016 at 19:40
  • 2
    Didn't work to remove watermark added by Master PDF Editor.
    – fccoelho
    Dec 27, 2018 at 12:10
-3

To remove watermark from pdf

  1. open the PDF in notepad++ or textpad
  2. search for desired watermark text and use 'find and replace' option to replace it with nothing (blank)
  3. save the file
  4. Open in standard adobe reader

Will throw error like - "file damaged,repair needed"

  1. Exit, you will be prompted to save the file

save it

1
  • 1
    Is this a general solution? What is www.it-ebooks.info?
    – Karlo
    Mar 31, 2018 at 17:23

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