Skip to content

Page transformations are not applied to annotations #1386

@panhaoyu

Description

@panhaoyu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions