You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
488 B
16 lines
488 B
1 month ago
|
import datetime
|
||
|
|
||
|
import fitz # PyMuPDF
|
||
|
|
||
|
# 导入配置
|
||
|
from Config import source_pdf, images_dir, time_format
|
||
|
|
||
|
# 打开PDF文件
|
||
|
pdf = fitz.open(source_pdf)
|
||
|
for page_num in range(len(pdf)):
|
||
|
page = pdf.load_page(page_num)
|
||
|
pix = page.get_pixmap(dpi=300)
|
||
|
pix.save(f"{images_dir}\\page_{page_num}.png")
|
||
|
# 输出当前时间,格式:年月日时分秒 和 提示信息
|
||
|
print(f"{datetime.datetime.now().strftime(time_format)} 正在处理第{page_num}页")
|