Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

The "data.pdf" can be of type PdfFileWriter, which does not have a "stream" attribute. #15

Merged
merged 1 commit into from
Feb 3, 2022

Conversation

ChrisBuergi
Copy link

The following code fails to write the output for the second page of the attached PDF. With the fix in the pull request it does work as expected.
Although I'm not quite sure if this is just a symptom of another problem that manifests itself there.

from PyPDF3 import PdfFileWriter, PdfFileReader

if __name__ == '__main__':
    input_pdf = PdfFileReader('2022-02-03_regiogis.pdf', strict=True)
    for p in [0, 1]:
        page = input_pdf.getPage(p)
        output_pdf = PdfFileWriter()
        output_pdf.addPage(page)
        with open('Page{}.pdf'.format(p), 'wb') as of:
            output_pdf.write(of)

2022-02-03_regiogis.pdf

@sfneal sfneal merged commit 231af75 into sfneal:master Feb 3, 2022
@ChrisBuergi
Copy link
Author

Thanks for the merge and all the work for PyPDF3.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants