I would like to rotate PDF pages around the center (other than just multiples of 90°) in a PDF document and optionally scale them to fit into the original page.
Here on StackOverflow, I found a few similar questions, however, mostly about the outdated PyPDF2.And in the latest pypdf documentation, I could not find (or overlooked) a recipe to rotate pages around the center, e.g. for slightly tilted scanned documents, which require rotation of a few degrees.
I know that there is the Transformation Class
, but the standard rotation is around the lower left corner and documentation is not explaining in detail what the matrix elements actually are.
How to rotate a PDF page around the center and optionally scale it that it fits into the original page?