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

Page transformations are not applied to annotations #1386

Closed
panhaoyu opened this issue Oct 9, 2022 · 0 comments · Fixed by #1479
Closed

Page transformations are not applied to annotations #1386

panhaoyu opened this issue Oct 9, 2022 · 0 comments · Fixed by #1479
Labels
is-feature A feature request

Comments

@panhaoyu
Copy link

panhaoyu commented Oct 9, 2022

Replace this: What happened? What were you trying to achieve?

Environment

Which environment were you using when you encountered the problem?

$ python -m platform
# Windows-10-10.0.19044-SP0

$ python -c "import PyPDF2;print(PyPDF2.__version__)"
# 2.2.0

Code + PDF

This is a minimal, complete example that shows the issue:

from PyPDF2 import PdfReader, PdfWriter, Transformation

reader = PdfReader('check.pdf')
writer = PdfWriter()
for page in reader.pages:
    page.add_transformation(Transformation().scale(0.5))
    writer.add_page(page)
writer.write('output.pdf')

Share here the PDF file(s) that cause the issue. The smaller they are, the
better. Let us know if we may add them to our tests!

check.pdf

Traceback

This is the complete Traceback I see:

output.pdf

By doing a scale with a factor of 0.5, I hope to scale the whole page, but the comments do not scale.

Source:
image

Result:
image

Hope:
image

Anyway, nice work, and thanks for your open source.

@MartinThoma MartinThoma changed the title Transformation for comment does not work Page transformations are not applied to annotations Oct 9, 2022
@MartinThoma MartinThoma added the is-feature A feature request label Oct 10, 2022
MartinThoma pushed a commit that referenced this issue Dec 10, 2022
PDF annotations - for example hyperlinks and comments - were not properly scaled when using the scale function.

Fixes #1386
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 a pull request may close this issue.

2 participants