一、使用ilovepdf免费编辑
注意一次性最多编辑100M的文件,网址如下:
https://www.ilovepdf.com/merge_pdf
二、使用PyPDF2
官网:https://github.com/py-pdf/PyPDF2
使用命令行工具安装:
pip install PyPDF2 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
注:
1)http://mirrors.aliyun.com/pypi/simple/ 阿里云
2)https://pypi.mirrors.ustc.edu.cn/simple/ 中国科技大学 3)
http://pypi.douban.com/simple/ 豆瓣 4)
https://pypi.tuna.tsinghua.edu.cn/simple/ 清华大学 5)
http://pypi.mirrors.ustc.edu.cn/simple/ 中国科学技术大学
合并PDF示例:
from PyPDF2 import PdfMerger
merger = PdfMerger()
for pdf in ["D:\\file1.pdf", "D:\\file2.pdf"]:
merger.append(pdf)
merger.write("D:\\merged-pdf.pdf")
merger.close()