Watermarks are a clear, yet subtle way of identifying the owner of a particular file.

While people may find them annoying, they serve their purpose gracefully.

What Is the ReportLab Module?

Watermark image of a document displayed on an e-reader

To add a watermark to a PDF file, youll need a good library like the ReportLab module.

This module helps you to generate dynamic PDfs, convert XML files to PDFs, and generate reports.

What Is the PyPDF2 Module?

Sai Ashish Text Watermark

These include cropping, merging, splitting, rotating, transforming, adding data, stamping, and watermarking.

Voila, your watermarked PDF is then ready.

Begin your program by importingcanvasfrompdfgen, located in thereportlabmodule.

PDF Text Watermark Sample

The pdfgen interface acts at the lowest level to generate PDFs.

you could visualize it as painting a document design and structure on a page.

The canvas class provides the operations needed to do so.

you’re free to think of the canvas as a sheet of plain paper with Cartesian coordinates.

The point of origin (0,0) is in the lower left corner.

From the ReportLab library, importinch,color,andpagesize.

The program will use inches as the unit of measurement.

There are two color formats available under ReportLab: theRGBmodel, and theCYMKmodel.

As the name suggests, the size of the page is set toA4.

Additionally, import thePdfFileReaderandPdfFileWriterfromPyPDF2to perform read and write operations on PDF files.

Ask the user to input the text of the watermark using the input statement.

Use the canvas to generate a drawing area with the name watermark.pdf and A4 pagesize.

Thetranslate()function moves the origin to the upper left corner.

Set the font style to Helvetica with a size of 50.

Apply a rotation of 45 degrees in the counterclockwise direction.

Input the name of the file you want to watermark, including any.pdfextension.

Initialize a variable to store the name of the watermarked PDF.

Open both files in the read binary mode.

Use thePdfFileReader()to instantiate an object that represents each PDF.

Use thegetPage()function to get the first and only page of the watermarked PDF.

Now its time to merge the watermark page with each page in the target PDF.

Create an object of the PdfFileWriter class to use for generating the output PDF.

Define a loop that iterates over each page in the desired PDF.

The getNumPages() function returns the total number of pages in a PDF.

Use the getPage() function to get the page and merge it with the watermark page stored earlier.

Use the PdfFileWriter object to add each merged page to the final PDF.

you’re able to also usetechniques to watermark your videosin just a few minutes.

For free watermark removal in videos, use Apowersoft, 123apps, PickFrom Blur, and BeeCut.

However, remember not to use any copyrighted material without the owners permission.