Dewatering a pdf
There is this pdf ebook that I want to read, but it has a really annoying 'DRAFT' water mark on every page. I looked for an automatic way to remove the watermark and found a really handly superuser answer that completely covers it.
$ pdftk original.pdf output uncompressed.pdf uncompress
$ sed -e "s/watermarktextstring/ /" uncompressed.pdf > unwatermarked.pdf
$ pdftk unwatermarked.pdf output fixed.pdf compress
Before I ran that I tried grepping through the pdf for the string 'DRAFT', now
the pdf was compressed so I didn't find anything. I wanted to make sure the
watermark was just a string so I extract just the first page with
pdfseperate
.
$ pdfseparate -f 1 -l 1 ipv6_for_ipv4_experts_en_a4.pdf out.pdf
I opened
out.pdf
with
inkscape
and played with editing the watermark, which
was indeed just text. I then round tripped the pdf through
pdftk
and
generated a watermark free pdf.
Reading: Gun Machine, The Difference Engine