python 提取PDF文字

使用pdfplumber,不能提取扫描的pdf和插入的图片。

python 复制代码
import pdfplumber

file_path = r'D:\UserData\admindesktop\官方文档\1903_Mesh-Models-Overview_FINAL.pdf'
with pdfplumber.open(file_path) as pdf:
    page = pdf.pages[0]
    print(page.extract_text()) # 所以文字
    print([word["text"] for word in page.extract_words()]) # 提取存在的文字
相关推荐
cui_ruicheng1 分钟前
Python从入门到实战(六):非序列容器
开发语言·python
飞猪~31 分钟前
Langchain python版本 LLM 重要函数invoke,ainvoke,stream,astream,batch,abatch
python·langchain·batch
沙蒿同学1 小时前
当古诗词遇上 AI:从 38 万句诗词中取一个好名字
python·算法·架构
xxie1237941 小时前
Python装饰器与语法糖
开发语言·python
CClaris2 小时前
大模型量化从0到1(五):GPTQ 原理详解 + 从零量化一个真实大模型
人工智能·python·算法·机器学习
Railshiqian2 小时前
UserPickerActivity 内部逻辑分析
开发语言·python
一tiao咸鱼2 小时前
前端转 agent # 02 - FastAPI 框架入门与原理
前端·python
Yolo566Q2 小时前
Noah-MP陆面过程模型建模方法与站点、区域模拟实践技术应用
开发语言·python
肖永威3 小时前
麒麟 V10 编译 Python 3.11 依赖包缺失与版本冲突问题解决实录
运维·python·麒麟操作系统
Csvn3 小时前
Python 开发技巧 · 类型注解进阶 —— 从 `TypeVar` 到 `Protocol`,让类型检查真正帮你抓 bug
后端·python