PDF 转图片 非常简单
Posted lovescience
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PDF 转图片 非常简单相关的知识,希望对你有一定的参考价值。
###参考https://blog.csdn.net/sinat_41657218/article/details/102487258
### 在Pycharm Terminal里pip install PyMuPDF
### 在Pycharm Terminal里pip install PyMuPDF
import fitz
rotate = int(0)
zoom_x = 1.0
zoom_y = 1.0
trans = fitz.Matrix(zoom_x, zoom_y).preRotate(rotate)
open_file_path = "E:/pyproject/Scival.pdf"
save_file_path = "E:/pyproject"
pdf = fitz.open(open_file_path )
for i in range(pdf.pageCount):
pm = pdf[i].getPixmap(matrix=trans, alpha=False)
pm.writePNG(save_file_path + ‘/%s.png‘ % i)
rotate = int(0)
zoom_x = 1.0
zoom_y = 1.0
trans = fitz.Matrix(zoom_x, zoom_y).preRotate(rotate)
open_file_path = "E:/pyproject/Scival.pdf"
save_file_path = "E:/pyproject"
pdf = fitz.open(open_file_path )
for i in range(pdf.pageCount):
pm = pdf[i].getPixmap(matrix=trans, alpha=False)
pm.writePNG(save_file_path + ‘/%s.png‘ % i)
以上是关于PDF 转图片 非常简单的主要内容,如果未能解决你的问题,请参考以下文章