-
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
ENH: Restore merge_transformed_page & co + add 'over' parameter #1567
Conversation
for performance
was not sure it would have worked😉 Co-authored-by: Martin Thoma <info@martin-thoma.de>
still in progress to confirm use cases |
Codecov ReportBase: 91.90% // Head: 91.94% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1567 +/- ##
==========================================
+ Coverage 91.90% 91.94% +0.03%
==========================================
Files 33 33
Lines 6252 6368 +116
Branches 1244 1271 +27
==========================================
+ Hits 5746 5855 +109
+ Misses 326 325 -1
- Partials 180 188 +8
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
include new param Over test added
pending a last check but ready for review |
This includes the (decimal -> float) change, so I suggest we first handle #1563 before we merge this PR. |
pypdf/_page.py
Outdated
@@ -315,7 +315,9 @@ def __repr__(self) -> str: | |||
return f"Transformation(ctm={self.ctm})" | |||
|
|||
def apply_on( | |||
self, pt: Union[Tuple[Decimal, Decimal], Tuple[float, float], List[float]] | |||
self, | |||
pt: Union[Tuple[Decimal, Decimal], Tuple[float, float], List[float]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still Decimal or is it float?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree Decimal is no more required.
pypdf/generic/_base.py
Outdated
value = value.decode() | ||
else: | ||
value = str_(value) | ||
value = float(value) | ||
return float.__new__(cls, value) | ||
except Exception as e: | ||
# If this isn't a valid decimal (happens in malformed PDFs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this has to be replaced by "float"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally part of the PR on float.
7cdfed0
to
e24367b
Compare
all good ? |
Github shows me that there is an update to the git submodule Do you happen to know what was changed? |
Thank you for the PR @pubpub-zz 🤗 I'll release it today |
Just a small point for me this
I have some issues about it saying there is some changes but I'm unable to discard them. I did no change about it. PS : Should not we consider this PR as an enhancement as there is some new functions ? |
An enhancement for me is something new the user can do which they couldn't do before. Is there anything like that? To me it looks like the merging functionality has been fixed, but it did work at some point before (right?) |
The |
By the way: Why did you introduce that parameter? (I should have asked that before) Aren't those two equivalent?
|
No Second, the standard case is to have already added in the page into the writer (I dislike the idea of "modifying" page in readers). |
Good point! That's something I completely missed 🤦 Yes, in that case I agree that it's actually a new feature / enhancement 👍 Thanks for explaining 🤗 |
NOTICE: pypdf changed the way it represents numbers parsed from PDF files. pypdf<3.4.0 represented numbers as Decimal, pypdf>=3.4.0 represents them as floats. Several other PDF libraries to this, as well as many PDF viewers. We hope to fix issues with too high precision like this and get a speed boost. In case your PDF documents rely on more than 18 decimals of precision you should check if it still works as expected. To clarify: This does not affect the text shown in PDF documents. It affects numbers, e.g. when graphics are drawn on the PDF or very exact positions are used. Typically, 5 decimals should be enough. New Features (ENH) - Enable merging forms with overlapping names (#1553) - Add 'over' parameter to merge_transformend_page & co (#1567) Bug Fixes (BUG) - Fix getter of the PageObject.rotation property with an indirect object (#1602) - Restore merge_transformed_page & co (#1567) - Replace decimal by float (#1563) Robustness (ROB) - PdfWriter.remove_images: /Contents might not be in page_ref (#1598) Developer Experience (DEV) - Introduce ruff (#1586, #1609) Maintenance (MAINT) - Remove decimal (#1608) [Full Changelog](3.3.0...3.4.0)
Added the
over
parameterFixes #1426
Fixes #1601