Member-only story

How to watermark many PDF files at the same time

Avi Parshan
4 min readSep 11, 2023

--

I needed to add a watermark to 15 PDFs’ at the same time and didn’t want to go through each individual file and merge it with the watermark.

Additionally, if you do not have an Adobe Creative Cloud license it becomes a bit of a challenge to modify PDF files (As Adobe Acrobat DC locks down features for free users).

This is my watermark file, in yours you can be more subtle and change the color to light gray as well as decrease the opacity

Hello World Watermark

Here is a sample (original) file:

and here is the end result!

Now, this same process can be done over and over for hundreds of files with this tutorial!

Firstly, you will need to create a single page PDF with your watermark or signature (This wont be covered in the tutorial).

Next, you will need to put the “source/original” documents in a folder that your code can access.

Install python and pip, then run this command (in your terminal) to install the PDF library that we will be using

pip install PyPDF2

Now, create your python file, I called it watermarker.py,

and add in the following code:

import os
from PyPDF2 import PdfReader, PdfWriter

#change this to your watermark file location
watermark_file = "C:/pdf_watermark/watermark.pdf"

#change this to folder containing the PDF files to process
pdf_folder = "C:/pdf_watermark/source/"

#change this to the folder where you want to resulting PDFs to end up
output_folder = "C:/pdf_watermark/output/"
#the script will create this directory if it doesn't exist

os.makedirs(output_folder, exist_ok=True)

# Iterate through all PDF files in the folder
for filename in os.listdir(pdf_folder):
if filename.endswith(".pdf"):
# Full path to the input PDF
input_pdf_path = os.path.join(pdf_folder, filename)

# Read the input PDF…

--

--

Avi Parshan
Avi Parshan

No responses yet