首页 > 编程语言 > 详细

python——提取pdf中的指定页

时间:2021-03-07 08:58:56      阅读:175      评论:0      收藏:0      [点我收藏+]
from PyPDF2 import PdfFileWriter, PdfFileReader
 
# 开始页
start_page = 0
 
# 截止页
end_page = 5
 
output = PdfFileWriter()
pdf_file = PdfFileReader(open("3.pdf", "rb"))
pdf_pages_len = pdf_file.getNumPages()
 
# 保存input.pdf中的1-5页到output.pdf
for i in range(start_page, end_page):
 output.addPage(pdf_file.getPage(i))
 
outputStream = open("output.pdf", "wb")
output.write(outputStream)

转发自:https://www.jb51.net/article/149587.htm

python——提取pdf中的指定页

原文:https://www.cnblogs.com/shunguo/p/14493201.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!