Skip to content

The list of cloned objects is too large while using PdfWriter with incremental=True #3116

@m32

Description

@m32

Environment

Linux-6.1.0-31-amd64-x86_64-with-glibc2.36
pypdf==5.3.0, crypt_provider=('cryptography', '44.0.0'), PIL=11.1.0

Code

from pypdf import PdfReader, PdfWriter

reader = PdfReader('pdf-in.pdf')
writer = PdfWriter(reader, incremental=True)
with open("pdf-out.pdf", "wb") as fp:
    writer.write_stream(fp)

After running the above code, the generated pdf should add new objects starting from the element = /Size and starts adding from /Size+1.
What can be seen from the object number /Xref

Metadata

Metadata

Assignees

No one assigned

    Labels

    is-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