BACK TO THE HOMEPAGE

Jan 23, 2021 1 min read

Pdftk watermark removal

“PDFtk - The PDF Toolkit. PDFtk is a simple tool for doing everyday things with PDF documents. It comes in three flavors: PDFtk Free, PDFtk Pro, and our original command-line tool PDFtk Server.”

In a prior blog post, the PDFTK utility was installed. Now use the utility to remove a watermark from a PDF.

  1. Get the PDF with a watermark and copy it to the directory created e.g.
NODE_TYPE // bash
cp watermark.pdf ~/temp/convert
  1. Move to the convert directory
NODE_TYPE // bash
cd ~/temp/convert
  1. Uncompress the PDF
NODE_TYPE // bash
pdftk watermark.pdf output uncompress.pdf uncompress
  1. Use the SED utility to remove the watermark text e.g. replace WATERMARKTEXT with the text in your PDF. Ensure the text used is exactly that same as that identified in the PDF.
NODE_TYPE // bash
sed -e "s/WATERMARKTEXT/ /" uncompress.pdf > sanwatermark.pdf
  1. Open the new sanwatermark.pdf file with a PDF reader and confirm the watermark has been removed.

  2. Finally compress the sanwatermark.pdf file

NODE_TYPE // bash
pdftk sanwatermark.pdf output output.pdf compress

The file output.pdf is created without the watermark.