合并PDF
import osimport pypdf
from tkinter import filedialog, Tk
root = Tk()
root.withdraw()
pdfs = filedialog.askopenfilenames(title="Select PDF files to merge", filetypes=[("PDF Files", "*.pdf")])
if pdfs:
merger = pypdf.PdfMerger()
for pdf in pdfs:
merger.append(pdf)
output_file = filedialog.asksaveasfilename(title="Save merged PDF as", defaultextension=".pdf", filetypes=[("PDF Files", "*.pdf")])
if output_file:
merger.write(output_file)
merger.close()
print(f"PDF files merged successfully into {os.path.basename(output_file)}")
没看明白呢 同样没看懂得 有用,支持一下 我没看明白,唉。。。级别不够看不懂 好用,感谢 大概看懂了,批量合成pdf文件,Python的库真的是丰富多彩,功能强大
页:
[1]