There's more...

PDF is such a flexible format that it is very standard, but that also means that it can be difficult to parse and process.

While most PDF files contain text information, it is not uncommon that they contain images. This, for example, happens very often with scanned documents. This means that the information is stored as a collection of images, instead of in text. This makes it difficult to extract the data; we end up having to resolve to methods such as OCR to parse the images into text.

PyPDF2 does not provide a good interface to deal with images. You may need to transform the PDF into a collection of images and then process them. Most PDF readers can do it, or you can use a command-line tool such as pdftooppm (https://linux.die.net/man/1/pdftoppm ...

Get Python Automation Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.