How to remove watermark in PDF

Here I will show you how is easy to remove a watermark from PDF file.

      This watermarks you can see many time in PDF eBooks which you can download from free Internet resources. Some Web site owners to keep trademark and make users to come back again – using a tricks as inserting website URL address into PDF document. Its really make some time annoying as you don’t want your copy of eBook will be looks like second hand but as original PDF from Publisher company.

      Let say – You’ve downloaded many PDF files from one of internet resource ( Example: All your PDF eBooks are stamped by some word in each pages. This is actually is TEXT object in PDF script file which is possible to remove using right way of binary compatible parsing mechanism. Most UNIX/Linux like Shell utilities can not proper fetch all strings in STDINPUT and write it back to STDOUT to the file cause of binary meta tags in PDF file.

      I’ve wrote some simple easy fast script which removing the watermark word string in all PDF files from required folder. You just need to provide a folder path as an input parameter and script will show you which PDF file the watermark has been removed
The script will provide verbose output to the console. Additionally – you need just modify the script to write the exact watermark word string.





find “$1” -type f -name “*.pdf” -print0|while read -d $’\0′ file;


if [ `strings “$file”|grep -c “”` -gt 0 ];—- Replace it with required word string


echo “$file”;

cp “$file” /tmp/1.pdf;

script=$(cat <<‘EOF’

use strict;

use warnings;

open(my $in, ‘<‘, ‘/tmp/1.pdf’)

or die “Cannot open input.txt: $!”;

open(my $out, ‘>’, ‘/tmp/2.pdf’)

or die “Cannot open output.txt: $!”;

while (<$in>) {

print $out $_ unless /; —- Replace it with required word string






/usr/bin/perl -e “$script”

mv -v /tmp/2.pdf “$file”;

rm /tmp/1.pdf




To run this script – simple run it with full path to folder where all your PDF files is located as input parameter:

# ~/Documents/PDF

/tmp/2.pdf -> /Users/user1/Documents/PDF/file1.pdf
/tmp/2.pdf -> /Users/user1/Documents/PDF/file2.pdf
/tmp/2.pdf -> /Users/user1/Documents/PDF/file3.pdf


Don’t forget to give executable permission to the script:

# chmod +x



Eldar Aydayev