Skip to content

PageObject.transfer_rotation_to_content() hides some content since pypdf 4.3.0 #2927

@stefan6419846

Description

@stefan6419846

Calling page.transfer_rotation_to_content() changes the visibility of some content after upgrading from version 4.2.0 to 4.3.0 for some PDF files. The corresponding text layer is invisible, but can be selected.

When viewing the diff, two Q operators are missing in version 4.3.0.

Environment

Which environment were you using when you encountered the problem?

$ python -m platform
Linux-6.4.0-150600.23.25-default-x86_64-with-glibc2.38

$ python -c "import pypdf;print(pypdf._debug_versions)"
pypdf==5.1.0, crypt_provider=('local_crypt_fallback', '0.0.0'), PIL=none

Code + PDF

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

from pypdf import PdfWriter

writer = PdfWriter(clone_from='file.pdf')
for page in writer.pages:
    page.transfer_rotation_to_content()
writer.write('out.pdf')

I do not have a suitable PDF file at the moment, but I am working on getting one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    PdfWriterThe PdfWriter component is affectedis-regressionRegression introduced as a side-effect of another change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions