我尝试使用 pypdf 模块打印 pdf 文档的数量,其中包括一些空白的白色 pdf 页面。但它避免了空白页并打印剩余页面的计数。下面是代码。
import sys
import pyPdf
from pyPdf import PdfFileReader, PdfFileWriter
pdf_document = PdfFileReader(file(normalpdfpath,"r"))
normal = pdf_document.getNumPages()
print normal
Run Code Online (Sandbox Code Playgroud) python-2.7 ×1