PDF files have some interesting security measures to limit the distribution of a document. We can encrypt the content, making it necessary to know a password in order to be able to read it. We'll see as well how to add a watermark to label the document clearly as not for public distribution and, if leaked, to know its origin.
Watermarking and encrypting a PDF
Getting ready
We'll use the pdf2image module to transform PDF documents to PIL images. Pillow is a prerequisite. We'll also use PyPDF2:
$ echo "pdf2image==0.1.14" >> requirements.txt
$ echo "Pillow==5.1.0" >> requirements.txt
$ echo "PyPDF2==1.26.0" >> requirements.txt
$ pip install -r requirements.txt
For pdf2image...