简体   繁体   English

从python中的pdf文件对象中提取文本

[英]extract text from pdf file object in python

can we extract text from pdf file object collected from request for example 我们可以从例如从请求中收集的pdf文件对象中提取文本吗

f = request.FILES.get('file', None)

So from f can we extract text of the document as we get text content from text file object. 因此,当我们从文本文件对象获取文本内容时,可以从f中提取文档的文本。

Try using this library called textract 尝试使用名为textract的库

http://textract.readthedocs.io/en/latest/ http://textract.readthedocs.io/en/latest/

It supports a lot of formats including PDF 它支持多种格式,包括PDF

import textract
text = textract.process("path/to/file.extension")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM