Ubuntu PDF OCR 工具—OCRmyPDF

时间:2021-06-04 00:04:33   收藏:0   阅读:29

简介

开源 OCR 工具,识别扫描版 PDF 使其可以搜索、复制等

OCR, Optical Character Recognition,光学字符识别,是指对文本资料的图像文件进行分析识别处理,获取文字及版面信息的过程

github: https://github.com/jbarlow83/OCRmyPDF

docs: https://ocrmypdf.readthedocs.io/en/latest/

安装

安装 ocymypdf 及依赖

sudo apt-get -y remove ocrmypdf # 本机未安装 ocrmypdf 旧版
sudo apt-get -y update
sudo apt-get -y install     ghostscript     icc-profiles-free     liblept5     libxml2     pngquant     python3-cffi     python3-distutils     python3-pkg-resources     python3-reportlab     qpdf     tesseract-ocr     zlib1g     unpaper
    
wget https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py

export PATH=$HOME/.local/bin:$PATH
python3 -m pip install --user ocrmypdf

安装 JBIG2 encoder

git clone https://github.com/agl/jbig2enc
cd jbig2enc
./autogen.sh
./configure && make
[sudo] make install

遇到的问题

执行 ./autogen.sh

执行./configure && make

安装语言包

中文简体

sudo apt install tesseract-ocr-chi-sim

命令

ocrmypdf -l chi_sim --output-type pdf [source.pdf] [ocr.pdf]

示例

ocrmypdf -l chi_sim --output-type pdf 正则表达式必知必会\(修订版\).pdf 正则表达式必知必会\(修订版\)-ocr.pdf --force-ocr

原文:https://www.cnblogs.com/usmile/p/14846701.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!