给定一个pdf文件,有没有办法找到它的页面尺寸和方向(水平或垂直)等?pypdf2库提供了一个检查页数的函数,但如何提取其他信息?是否可以使用此链接查找有关该文件的信息。创建日期、页数、标题等?或者任何其他可能的事情
from PyPDF2 import PdfFileWriter, PdfFileReader
input1 = PdfFileReader(open("document1.pdf", "rb"))
# print how many pages input1 has:
print "document1.pdf has %d pages." % input1.getNumPages()
您可以使用
/Rotate
来获得页面的旋转它将产生以度为单位的值。尽管它可能对某些文档有用,但您应该注意,页面旋转本身并不表示方向。正如注释中的@mkl所述
至于其他元数据,有很多东西可以提取。您可以查看所有这些方法的
PyPDF2.pdf.DocumentInformation
方法相关问题 更多 >
编程相关推荐