Chinaunix首页 | 论坛 | 博客
  • 博客访问: 112446
  • 博文数量: 15
  • 博客积分: 152
  • 博客等级: 入伍新兵
  • 技术积分: 255
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-29 17:10
文章分类

全部博文(15)

文章存档

2017年(1)

2015年(1)

2013年(8)

2012年(5)

分类: Python/Ruby

2017-05-04 02:08:04


点击(此处)折叠或打开

  1. >>> from ABBYY import CloudOCR
  2. >>> ocr_engine = CloudOCR(application_id='YOUR_ABBYY_APPLICATION_ID', password='YOUR_ABBY_APPLICATION_PASSWORD')
  3. >>> pdf = open('budget1988.pdf', 'rb')
  4. >>> file = {pdf.name: pdf}
  5. >>> result = ocr_engine.process_and_download(file, exportFormat='xml,pdfTextAndImages', language='French')
  6. >>> result
  7. {'xml': <_io.BytesIO object at 0x2e2e290>, 'pdfSearchable': <_io.BytesIO object at 0x2e2e2f0>}
ABBYY 真好用 只需要到官网注册一个账号,注册一个应用ID,就可以方便的用脚本将pdf进行ocr处理。 识别效果比Adobe Acrobat Pro要强不少,但是还是没有桌面版的abbyy要强,每月50页免费额度,分享到社交网站以后,每月增加100页免费额度,也就是说每月有150页额度,轻量经的使用也够了。 下面的代码即可将0.pdf进行原地OCR处理

点击(此处)折叠或打开

  1. with open('0.pdf', 'rb') as pdf:
  2.     file = {pdf.name : pdf}
  3.     result = ocr_engine.process_and_download(file, exportFormat='pdfSearchable', language='ChinesePRC')
  4. with open('0.pdf', 'wb') as pdf:
  5.     pdfSearchable = result.get('pdfSearchable')
  6.     pdf.write(pdfSearchable.read())
阅读(2303) | 评论(0) | 转发(0) |
0

上一篇:Python版的数字转汉字程序

下一篇:没有了

给主人留下些什么吧!~~