Python 合并几个pdf文档

import os
from PyPDF2 import PdfMerger
#PyPDF2-3.0.1

target_path = r’C:\Users\Administrator\Desktop\1\’
pdf_lst = [f for f in os.listdir(target_path) if f.endswith(‘.pdf’)]
pdf_lst = [os.path.join(target_path, filename) for filename in pdf_lst]

file_merger = PdfMerger()
for pdf in pdf_lst:
file_merger.append(pdf,import_outline=False) # 合并pdf文件

file_merger.write(r"merge.pdf")

你可能感兴趣的:(python,pdf,前端)