`
xuanzhui
  • 浏览: 197249 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

通过Python将PDF转换成图片

阅读更多

以下是在 Mac 中通过 Python3 将 PDF 文档转换成每一页一个图片

 

核心库 pdf2image

 

首先安装依赖 poppler

brew install poppler

 

再安装库

pip3 install pdf2image

 

开始转换

pages = convert_from_path('need_to_convert.pdf')

for i in range(0, len(pages)):
    pages[i].save(f'image{i+1}.png', 'PNG')

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics