旋转pdf文件

from PyPDF2  import  PdfFileReader,PdfFileWriter
读pdf=PdfFileReader(r"E:pdfpython.pdf")
写pdf=PdfFileWriter()
页=读pdf.getPage(0).rotateClockwise(90)   #顺时针旋转90度
写pdf.addPage(页)


页_1=读pdf.getPage(1).rotateCounterClockwise(90)   #逆时针旋转90度
写pdf.addPage(页_1)


#开始保存文件
with  open("E:pdf旋转_1.pdf","wb")  as  f:
    写pdf.write(f)
    
原文地址:https://www.cnblogs.com/luckiness/p/13304779.html