Skip to content

AttributeError: 'EncodedStreamObject' object has no attribute 'getData' #1138

Description

@Richzendy

I'm have a script to extract attachment from PDF files, everything was working to upgrade pyPDF2 to the last version, i'm getting this error:

AttributeError: 'EncodedStreamObject' object has no attribute 'getData'

This is part of my code to extract atrachment from PDF:

    pdf = pf.PdfFileReader(fname)

    # Step 2 "The process of traversing the PDF tree structure"
    catalog = pdf.trailer['/Root']

    fDetail = catalog['/Names']['/EmbeddedFiles']['/Names']

    soup = fDetail[1].getObject()
     # Step 3 Stream data to a variable for further use
    file = soup['/EF']['/F'].getData()

Environment

This error happen with PyPDF2 version 1.28.3 and above, my code works with 1.28.2 version.

I've made rollback to 1.28.2 version to get working everything again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions