jsvine / pdfplumber

Plumb a PDF for detailed information about each char, rectangle, line, et cetera — and easily extract text and tables.
MIT License
6.1k stars 625 forks source link

AttributeError: module 'pdfplumber' has no attribute 'load' #821

Closed juzj closed 1 year ago

juzj commented 1 year ago

The current version is 0.8.0

response = requests.get(url) pdf_data = response.content

使用pdfplumber打开PDF文件

with pdfplumber.load(pdf_data) as pdf:

遍历PDF中的所有页面

for page in pdf.pages:
    # 提取页面中的表格信息
    tables = page.extract_tables()
    # 打印表格内容
    for table in tables:
        print(table)
jsvine commented 1 year ago

Hi @juzj, .load(...) was deprecated in 0.5.23 and removed in 0.6.0 (see here). You'll want to use .open(...) instead.