Registry / data / pdfminer2

pdfminer2

JSON →
library20151206pypypiunverified

A fork of PDFMiner for Python 3. Provides tools for extracting text, images, and metadata from PDF files. Version 20151206 is the last release; the project is largely superseded by pdfminer.six.

pip install pdfminer2
INSTALL
IMPORT
SIG · PDFMINER2
P
pdfminer2
datapythonv20151206
Install
1.7s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v20151206 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PDFParser
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfparser import PDFParser
PDFDocument
from pdfminer.pdfdocument import PDFDocument
PDFPageInterpreter
from pdfminer.pdfinterp import PDFPageInterpreter

Extract text from a PDF file using pdfminer2.

from pdfminer.pdfparser import PDFParser from pdfminer.pdfdocument import PDFDocument from pdfminer.pdfpage import PDFPage from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter from pdfminer.converter import TextConverter from pdfminer.layout import LAParams from io import StringIO # Open PDF file with open('sample.pdf', 'rb') as fh: parser = PDFParser(fh) doc = PDFDocument(parser) rsrcmgr = PDFResourceManager() retstr = StringIO() laparams = LAParams() device = TextConverter(rsrcmgr, retstr, laparams=laparams) interpreter = PDFPageInterpreter(rsrcmgr, device) for page in PDFPage.create_pages(doc): interpreter.process_page(page) text = retstr.getvalue() device.close() retstr.close() print(text)
Debug
Known issues
deprecatedpdfminer2 is deprecated. Use pdfminer.six for active maintenance and Python 3 support.
fix
Replace pdfminer2 with pdfminer.six (pip install pdfminer.six) and update imports to pdfminer.high_level.
affects: all
breakingImport paths differ between pdfminer2 and newer forks like pdfminer.six. Code that works on one may break on the other.
fix
If migrating from pdfminer2 to pdfminer.six, use 'from pdfminer.high_level import extract_text' for simpler extraction.
affects: all
gotchaThe PDFDocument constructor may not validate the password argument; calling doc.initialize() can raise TypeError if password is wrong.
fix
Wrap doc.initialize(password=...) in try-except or provide the correct password.
affects: all
Upgrade
Version history
20151206latest on PyPI · released Dec 5, 2015
Audit
Dependencies
pycryptodomeoptionalPDF encryption support
Agent activity
4 hits · last 30 days
node
4
Resources
pdfminer2 — pip install pdfminer2 · libregistry