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 to properly work, it needs to install pdftoppm, so check here for instructions on how to install it for different platforms: https://github.com/Belval/pdf2image#first-you-need-pdftoppm.

We also need a PDF file to watermark and encrypt. We'll use a report.pdf file generated by the structuring_pdf.py script, available in GitHub at https://github.com/PacktPublishing/Python-Automation-Cookbook/blob/master/chapter5/structuring_pdf.py.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.159.197