-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rotate PDF fails if /Rotate is set to an IndirectObject #337
Labels
is-bug
From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF
needs-example-code
The issue needs a minimal and complete (e.g. all imports) example showing the problem
needs-pdf
The issue needs a PDF file to show the problem
Comments
Opened #338 |
mstamy2
added a commit
that referenced
this issue
Dec 27, 2017
Fix issue #337 - Rotate PDF fails if /Rotate is set to an IndirectObject
This was referenced Mar 13, 2019
Closed
MartinThoma
added
the
is-bug
From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF
label
Apr 7, 2022
Now that #338 is merged + released, can somebody check if the issue still exists? Can somebody maybe share an example PDF + code that was showing the issue? |
MartinThoma
added
the
needs-change
The PR/issue cannot be handled as issue and needs to be improved
label
Apr 22, 2022
I believe this was fixed. Please let me know if it wasn't. |
MartinThoma
added
needs-pdf
The issue needs a PDF file to show the problem
needs-example-code
The issue needs a minimal and complete (e.g. all imports) example showing the problem
and removed
needs-change
The PR/issue cannot be handled as issue and needs to be improved
labels
Jun 26, 2022
mitchelljkotler
added a commit
to mitchelljkotler/pypdf
that referenced
this issue
Feb 3, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
is-bug
From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF
needs-example-code
The issue needs a minimal and complete (e.g. all imports) example showing the problem
needs-pdf
The issue needs a PDF file to show the problem
Some example page objects below:
This works because '/Rotate' is set to an integer value
{'/Contents': IndirectObject(5, 0), '/Rotate': 270, '/Type': '/Page', '/Resources': IndirectObject(6, 0), '/CropBox': [0, 0, 612, 792], '/Parent': IndirectObject(1, 0), '/MediaBox': [0, 0, 612, 792]}
This will work because '/Rotate' is missing and get will return the default 0 value
{'/Parent': IndirectObject(3, 0), '/Contents': IndirectObject(4, 0), '/Type': '/Page', '/Resources': IndirectObject(6, 0), '/MediaBox': [0, 0, 612, 792]}
But if you encounter a case where '/Rotate' gets set to an IndirectObject such below:
{'/Contents': IndirectObject(2, 0), '/Rotate': IndirectObject(12, 0), '/Type': '/Page', '/Resources': IndirectObject(3, 0), '/CropBox': [0, 0, 603, 751], '/Parent': IndirectObject(13, 0), '/MediaBox': [0, 0, 603, 751]}
PyPDF2 throws an exception when attempting to rotate the page.
Example Code:
Output:
The text was updated successfully, but these errors were encountered: