Skip to content

page 2 blended with page 1 on output via append #1595

@kimberv

Description

@kimberv

I need to read in a fillable form pdf, fill it out, then generate result pdf. this is largely working, except that page 2 of the pdf (which contains only text) doesn't get properly appended. It's text contents are laid over the top of a copy of page 1.

Environment

Which environment were you using when you encountered the problem?

$ python -m platform
macOS-11.6.5-x86_64-i386-64bit

$ python -c "import pypdf;print(pypdf.__version__)"
3.3.0

Code + PDF

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

from pypdf import PdfReader, PdfWriter

reader = PdfReader('cms1500.pdf')
writer = PdfWriter()
writer.append(reader)

with open('copy.pdf', "wb") as output_stream:
    writer.write(output_stream)

Pdf source is
form-cms1500.pdf - a standard pdf in healthcare. There should be no problem with you using it in test suites.

Results

Outcome from using writer.append:
Screen Shot 2023-02-01 at 10 21 22 PM

Outcome from using writer.append(reader, [1])
Screen Shot 2023-02-01 at 10 22 48 PM

NOTE: Outcome from using writer.clone_document_from_reader does produce expected output BUT i can't use it as it causes other problems (namely after clone writer.pages items appear to be DictionaryObject and not PageObject):
Screen Shot 2023-02-01 at 10 24 26 PM

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