Skip to content

Content of dict returned by doc.embfile_info() does not fit to documentation #4050

Closed
@dasmy

Description

@dasmy

Description of the bug

Using doc.embfile_add(), I added an attachment to a pdf file. Then, I retrieved its metadata using doc.embfile_info().

In contrast to the documentation at https://pymupdf.readthedocs.io/en/latest/document.html#Document.embfile_info, the resulting dict does not contain a desc field for the description. Instead, the description is found under the key descender:

print(doc.embfile_info(name))
{'name': 'pdf_scraper_markdown_content', 'collection': 0, 'filename': 'fulltext.md', 'ufilename': 'fulltext.md', 'descender': 'Markdown representation of the PDF file content.', 'size': 67, 'length': 67, 'creationDate': "D:20241114103806+02'00'", 'modDate': "D:20241114103806+02'00'"}

How to reproduce the bug

With docbeing a pymupdf.Document, just call

doc.embfile_add('test', b'foobar', desc='some text')
print(doc.embfile_info('test'))

Result:

{'name': 'test', 'collection': 0, 'filename': 'test', 'ufilename': 'test', '**descender**': 'some text', 'size': 6, 'length': 6, 'creationDate': "D:20241114105413+02'00'", 'modDate': "D:20241114105413+02'00'"}

PyMuPDF version

1.24.13

Operating system

MacOS

Python version

3.12

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions