美文网首页
PDF OCR识别工具:OCRmyPDF解决图片类的pdf里的文

PDF OCR识别工具:OCRmyPDF解决图片类的pdf里的文

作者: wo_monic | 来源:发表于2021-09-10 18:34 被阅读0次

OCRmyPDF github

安装方法

  • ubuntu apt install ocrmypdf
  • conda conda install ocrmypdf

安装简体中文包

apt-get install tesseract-ocr-chi-sim

安装英语包

apt-get install tesseract-data-eng

显示所有的语言列表

apt-cache search tesseract-ocr
从展示的列表里选择你需要安装的语言的包,参照上面的命令安装即可。

OCR识别pdf

ocrmypdf --force-ocr old.pdf new.pdf

输出的new.pdf,即可复制文本。

配合img2pdf,把图片转为OCR识别的pdf

安装img2pdf
apt-get install img2pdf

img2pdf --pagesize A4 page*.png | ocrmypdf - myfile.pdf

把本目录下page开头的png图片合并到一个ocr的pdf。


把OCR识别转为txt文本 ocr2text github

sudo apt-get install tesseract-ocr
git clone https://github.com/writecrow/ocr2text.git
cd ocr2text
pip install --user --requirement requirements.txt 

python3 ocr2txt.py

相关文章

网友评论

      本文标题:PDF OCR识别工具:OCRmyPDF解决图片类的pdf里的文

      本文链接:https://www.haomeiwen.com/subject/aqdnwltx.html