We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm trying to create an N-up function.
If there are vertically long pages in the pdf document, first rotate them 90 degrees and then use "merge_translated_page".
page.rotate(90)
"transfer_rotation_to_content" was applied to fix rotated pages.
page.transfer_rotation_to_content()
The angle of the content has been fixed, but the annotation has returned to its original angle.
There is something similar in "merge_translated_page".
new_page.merge_translated_page(page, margin_left ,paper_height - (margin_top + page_height))
I asked Chatgpt how to move annotations and found the answer.
annotations = page.get("/Annots")
if annotations: for annotation in annotations: annotation_obj = annotation.get_object() rect = annotation_obj.get("/Rect") if rect: rect[0] = FloatObject(rect[0] +(margin_left)) rect[1] = FloatObject(rect[1] +paper_height - (margin_top + page_height)) rect[2] = FloatObject(rect[2] +(margin_left)) rect[3] = FloatObject(rect[3] +paper_height - (margin_top + page_height))
annotation_obj.update({ "/Rect": ArrayObject(rect) })
Looking at these things, I think that "pypdf" is fully capable of changing the location of annotations.
In the next update I hope that the annotations will also be moved along with the contents.
The text was updated successfully, but these errors were encountered:
This is a duplicate of #2592, thus I am going to close this issue in favor of the original report.
Sorry, something went wrong.
No branches or pull requests
Explanation
I'm trying to create an N-up function.
If there are vertically long pages in the pdf document, first rotate them 90 degrees and then use "merge_translated_page".
page.rotate(90)
"transfer_rotation_to_content" was applied to fix rotated pages.
page.transfer_rotation_to_content()
The angle of the content has been fixed, but the annotation has returned to its original angle.
There is something similar in "merge_translated_page".
new_page.merge_translated_page(page, margin_left ,paper_height - (margin_top + page_height))
I asked Chatgpt how to move annotations and found the answer.
annotations = page.get("/Annots")
if annotations:
for annotation in annotations:
annotation_obj = annotation.get_object()
rect = annotation_obj.get("/Rect")
if rect:
rect[0] = FloatObject(rect[0] +(margin_left))
rect[1] = FloatObject(rect[1] +paper_height - (margin_top + page_height))
rect[2] = FloatObject(rect[2] +(margin_left))
rect[3] = FloatObject(rect[3] +paper_height - (margin_top + page_height))
Looking at these things, I think that "pypdf" is fully capable of changing the location of annotations.
In the next update I hope that the annotations will also be moved along with the contents.
The text was updated successfully, but these errors were encountered: