Skip to content

PDFs aren't merged properly #1062

@gprzyby

Description

@gprzyby

After upgrading from version 1.28.1 to version 2.4.1 I've faced an issue with merging linked pdfs.
I've also checked previous versions and problem appears after 2.0.0 version

Environment

$ python -m platform
Linux-5.18.5-200.fc36.x86_64-x86_64-with-glibc2.28

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

Code + PDF

PDFs:
file1.pdf
file2.pdf
merged.pdf

from PyPDF2 import PdfMerger

merger = PdfMerger(strict=True)
merger.append("file1.pdf")
merger.merge(1, "file2.pdf")
merger.write("merged.pdf")

Traceback

There is no traceback, but after checking merged.pdf content from file2.pdf dosen't exists, but that slide has dimensions from file2.pdf
It looks like dimensions are from file2.pdf, but image comes from first slide of file1.pdf

Expected behavior

In second slide of merged.pdf we could see slides from file2.pdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    PdfMergerThe PdfMerger component is affectedPdfWriterThe PdfWriter component is affectedis-bugFrom a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions