Skip to content
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: Add transform method to Transformation #1765

Merged
merged 1 commit into from
Apr 14, 2023
Merged

Conversation

rrthomas
Copy link
Contributor

@rrthomas rrthomas commented Apr 2, 2023

I am the maintainer of PSUtils. I am adding PDF support, and rewriting the code in Python. pyPDF was a significant motivation for the choice of language, so thanks for that!

I need to express vertical and horizontal page flips, and the simplest way to achieve this seemed to be to add a general transform method to Transformation (I need all the different sorts of transformations to be applied repeatedly to the same page, so it's easier to change a Transformation than to make multiple copies of a page and transform that.) I have done this in the simplest way I could; it might be desired for the method to take a CompressedTransformationMatrix too.

If you agree to add an API something like this, I'll happily add some tests. (At the moment I just tested it with my experimental PSUtils code.)

@codecov
Copy link

codecov bot commented Apr 2, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (6836174) 92.99% compared to head (2a6494d) 92.99%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1765   +/-   ##
=======================================
  Coverage   92.99%   92.99%           
=======================================
  Files          34       34           
  Lines        6609     6612    +3     
  Branches     1302     1302           
=======================================
+ Hits         6146     6149    +3     
  Misses        302      302           
  Partials      161      161           
Impacted Files Coverage Δ
pypdf/_page.py 91.26% <100.00%> (+0.03%) ⬆️

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 in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@MartinThoma
Copy link
Member

I'm open to adding this 👍

What do you think @pubpub-zz ?

@pubpub-zz
Copy link
Collaborator

sounds good to me too.
A good example may be required to show users the way to use it

@pubpub-zz
Copy link
Collaborator

@rrthomas
👍 ❤️

@rrthomas
Copy link
Contributor Author

tox.ini seems to be missing a dependency, pytest-socket.

@MartinThoma MartinThoma changed the title Add transform method to Transformation ENH: Add transform method to Transformation Apr 14, 2023
@MartinThoma MartinThoma added the is-feature A feature request label Apr 14, 2023
@MartinThoma MartinThoma merged commit 3962c99 into py-pdf:main Apr 14, 2023
@MartinThoma
Copy link
Member

Thank you for your contribution @rrthomas! If you want, I'll also add you to https://pypdf.readthedocs.io/en/latest/meta/CONTRIBUTORS.html

@MartinThoma
Copy link
Member

The PR was just merged to main. It will be part of the release this weekend (pypdf==3.8.0)

@rrthomas
Copy link
Contributor Author

Thanks very much, I'd be delighted to be added to the contributors list, and I look forward to using the release!

MartinThoma added a commit that referenced this pull request Apr 16, 2023
New Features (ENH)
-  Add transform method to Transformation class (#1765)
-  Cope with UC2 fonts in text_extraction (#1785)

Robustness (ROB)
-  Invalid startxref pointing 1 char before (#1784)

Maintenance (MAINT)
-  Mark code handling old parameters as deprecated (#1798)

[Full Changelog](3.7.1...3.8.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is-feature A feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants