文档处理:免费将PDF转换PNG格式

源码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
from pdf2image import convert_from_path

def convert_pdf_to_png(pdf_path, output_prefix):
images = convert_from_path(pdf_path)
for i, image in enumerate(images):
output_path = f"{output_prefix}{i+1}.png"
image.save(output_path, "PNG")

# 指定输入的PDF文件路径和输出的图片前缀
pdf_file = "input.pdf"
output_prefix = "output"

# 调用函数进行转换
convert_pdf_to_png(pdf_file, output_prefix)

pyinstaller -F convertPdf2Png.py
将py文件打包为exe

exe下载地址

运行exe即可一键转换
将PDF转换PNG格式
https://github.com/whale3070/avi2mp4/releases/download/convertV2/convertPdf2Png.exe