Python and PDF: A Review of Existing Tools

The Portable Document Format (PDF) was invented in the early 1990s and it’s still thriving. But PDFs are mainly for humans – not machines. So it’s often hard to automatically extract information out of PDFs. Besides, more and more functionalities were put into PDF. The complexity of the format makes it hard to get started. But there are existing, well-established software tools. Some have been around for decades. In this blog post, I review some existing tools with the focus on Python. Python is the default language for data processing right now.

PDF Utility/System Libraries

There are some PDF libraries that power PDF Viewers but can also be used to work on PDFs from the command line.

  • ghostscript: PDF started with ghostscript so this is the mother of all PDF tools.
  • poppler: Used for the vast majority of Linux-based PDF viewers, Libre Office, etc. ‘poppler-utils’ is a collection of tools built upon poppler, e.g. ‘pdftotext’.
  • mutool: The library is used for an alternative, lightweight PDF viewer.
  • qpdf: Not a fully-fledged PDF library, mainly to manipulate PDFs.
  • pdftk (unmaintained)

Creating & Reading PDFs

Getting Information out of PDFs

  • parsr (recommended): tries to transform PDF into structured data, internally uses ‘pdfminer.six’, ‘camelot’ and more.
  • pdfplumber (recommended): works best on digital PDFs
  • pdfminer.six: a maintained fork of pdfminer
  • pdflib: wrapper around ‘poppler’. This library replaced the need for the specialized packages pdftotext and pdf2image that also use ‘poppler’.


General Text Extraction of Files


Further Resources

Please write me an email if you think a tool is missing.