I use PyPDF2 to get pdf file pages` dimension but it return negative number for some pdfs. Why? Here is an example, starting from second page, the real height is negative.
from PyPDF2 import PdfFileReader
input_file = PdfFileReader(open('file.pdf', "rb"))
for i in range(input_file.getNumPages()):
page = input_file.getPage(i)
real_width, real_height = page.mediaBox.getWidth(),
page.mediaBox.getHeight()
print(real_width, real_height)
The real height in some cases is negative, how can this happen?