PDFMiner is a text extraction tool for PDF documents.
Warning: Starting from version 20191010, PDFMiner supports Python 3 only.
For Python 2 support, check out
pdfminer.six.
Features:
Pure Python (3.6 or above).
Supports PDF-1.7. (well, almost)
Obtains the exact location of text as well as other layout information (fonts, etc.).
Performs automatic layout analysis.
Can convert PDF into other formats (HTML/XML).
Can extract an outline (TOC).
Can extract tagged contents.
Supports basic encryption (RC4 and AES).
Supports various font types (Type1, TrueType, Type3, and CID).
Supports CJK languages and vertical writing scripts.
Has an extensible PDF parser that can be used for other purposes.
How to Use:
> pip install pdfminer
> pdf2txt.py samples/simple1.pdf
Command Line Syntax:
pdf2txt.py
pdf2txt.py extracts all the texts that are rendered programmatically.
It also extracts the corresponding locations, font names, font sizes,
writing direction (horizontal or vertical) for each text segment. It
does not recognize text in images. A password needs to be provided for
restricted PDF documents.