Skip to main content

Watermarking PDFs

·289 words·2 mins
Misc
ALT
Author
ALT
Table of Contents
This is a fairly old (2023/04) article I originally wrote on a now-decommissioned Wiki, not completely sure it’s up to date

PDFTk and its StampTk tool apparently do a pretty good job at generating watermarks and applying them to a PDF file. However only the former is shareware, StampTk being a paid addition.

Fortunately it’s relatively easy to generate a stamp on GIMP, then apply it to a document with PDFTk.

Stamp creation
#

  1. Fire up GIMP, create a new image that’s about 400x200 pixels wide
  2. Add an alpha channel to your layer if it doesn’t have one already:
    watermark_gimp_alphachannel.png
  3. Press your Suppr key to remove the background, and add a text box with whatever you want to overlay on your PDF file. Change the font size to make it fit in the canvas
  4. Rotate and center the text, then merge its layer with the transparent background by right-clicking it > Merge down
  5. Go to Filters > Map > Tile…
    watermark_gimp_map.png
  6. Set the width to 826 and the height to 1169 (it’s likely possible to set it to a higher value as long as you keep this ratio)
  7. On the newly created picture, set the opacity to a reasonable number, such as 35 (so one can still see what’s going on behind the watermark)
  8. Export the image as PDF (NOTE: GIMP is currently bugged and has been for two years, export as PNG and use an online converter or imagemagick til it gets fixed)

Applying the stamp
#

Run the following command:

pdftk "yourfile.pdf" multistamp watermark.pdf output "yourfile-wm.pdf" flatten

The flatten option prevents editing text fields afterwards, though I strongly recommend “printing” the PDF to merge the entire file into one layer, so the watermark isn’t easily scrapped off the doc.