问题
Given a PDF document with multiple pages, how to check if a given page is rotated (-90, 90 or 180º)? Preferable using Python (pdfminer, pyPDF) ...
UPDATE: The pages are scanned, and most of the page is composed by text.
回答1:
I used simply /Rotate
attribute of the page in PyPDF2
:
pdf = PyPDF2.PdfFileReader(open('example.pdf', 'rb'))
orientation = pdf.getPage(pagenumber).get('/Rotate')
it can be 0
, 90
, 180
, 270
or None
来源:https://stackoverflow.com/questions/34515674/how-to-detect-a-rotated-page-in-a-pdf-document-in-python