I have a 4-page PDF where all the pages are visually rotated 270 degrees (90° counterclockwise).
I set the rotation of all pages to 90° (page.set_rotation(90)) and then save to a new file (pdf.save(path)). The problem is the first 2 pages are now correctly rotated (0°), while the last 2 become 90° rotated clockwise.
Running this code to check the original pages' detected rotation and mediabox values:
for page_idx in range(len(pdf_content)):
page = pdf_content[page_idx]
print("Page #{}:".format(page_idx), page.get_rotation(), page.get_mediabox())
I found out that the first and last 2 pages have different values:
Shouldn't page.set_rotation(90) always rotate exactly 90° clockwise regarding of the values above? If not, what would be the correct use of set_rotation in my case?
Thank you.
Install Info
pypdfium2 4.26.0
pdfium 122.0.6233.0 at D:\Python\Lib\site-packages\pypdfium2_raw\pdfium.dll
Python 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)]
Windows-10-10.0.19045-SP0
Name: pypdfium2
Version: 4.26.0
Summary: Python bindings to PDFium
Home-page: https://github.com/pypdfium2-team/pypdfium2
Author: pypdfium2-team
Author-email: geisserml@gmail.com
License: (Apache-2.0 OR BSD-3-Clause) AND LicenseRef-PdfiumThirdParty
Location: \Python\Lib\site-packages
Requires:
Validity
[X] I confirm that I ran all commands, and pasted the whole output.
Checklist
pypdfium2
fromPyPI
orGitHub/pypdfium2-team
.Description
I have a 4-page PDF where all the pages are visually rotated 270 degrees (90° counterclockwise).
I set the rotation of all pages to 90° (
page.set_rotation(90)
) and then save to a new file (pdf.save(path)
). The problem is the first 2 pages are now correctly rotated (0°), while the last 2 become 90° rotated clockwise.Running this code to check the original pages' detected rotation and mediabox values:
I found out that the first and last 2 pages have different values:
Shouldn't
page.set_rotation(90)
always rotate exactly 90° clockwise regarding of the values above? If not, what would be the correct use ofset_rotation
in my case?Thank you.
Install Info
Validity