Please refresh the page if equations are not rendered correctly.
---------------------------------------------------------------
使用PyPDF2
第三方Python包
from PyPDF2 import PdfReader, PdfWriter
import os
import copy
filename = "xxxx.pdf"
reader = PdfReader(filename)
savepath = "C://BinY//OneDrive - xxx.ca//xxx//"
num_page = reader.pages
outline = reader.outline
intro = outline[9]
pdf_writer = PdfWriter()
start = 19
st = copy.deepcopy(start)
end = 32
while start <= end:
pdf_writer.add_page(reader.pages[start -1])
start+=1
if not os.path.exists(savepath):
os.makedirs(savepath)
output_filename = savepath + '{}_{}_page_{}.pdf'.format(filename[:-4], st,end)
with open(output_filename,'wb') as out:
pdf_writer.write(out)
Comments NOTHING