本文介绍了在Python脚本中使用pypdfocr库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从Python脚本(而不是命令行)中运行pypdfocr?
How can you run pypdfocr from within a Python script, as opposed to the command line?
此问题如何调用pypdfocr函数是否可以在python脚本中使用它们?可以达到我想要的答案,但还不能完全解决问题.
This question How to call pypdfocr functions to use them in a python script? approaches the answer I want, but doesn't quite get there.
import pypdfocr
from pypdfocr import pypdfocr
from pypdfocr.pypdfocr import PyPDFOCR as pocr
filepath = 'C:/myfolder/myPDF.pdf'
newfile = pocr.run_conversion(filepath)
这会引发错误:
Unbound method run_conversion must be called with PyPDFOCR instance as first argument.
有人可以帮我填写(可能很明显)缺失的那一块吗?
Can someone help me fill in the (likely obvious) missing piece?
推荐答案
我成功进行了系统调用.
I made a system call with success.
cmd = "pypdfocr '"+str(file)+"'"
os.system(cmd)
这篇关于在Python脚本中使用pypdfocr库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!