diff --git a/docs/document.rst b/docs/document.rst index 36dc23d88..6b418e650 100644 --- a/docs/document.rst +++ b/docs/document.rst @@ -1551,21 +1551,19 @@ For details on **embedded files** refer to Appendix 3. :rtype: dict :returns: a dictionary with the following keys: - * *name* -- (*str*) name under which this entry is stored - * *filename* -- (*str*) filename - * *ufilename* -- (*unicode*) filename - * *desc* -- (*str*) description - * *size* -- (*int*) original file size - * *length* -- (*int*) compressed file length - * *creationDate* -- *(New in v1.18.13)* (*str*) date-time of item creation in PDF format - * *modDate* -- *(New in v1.18.13)* (*str*) date-time of last change in PDF format - * *collection* -- *(New in v1.18.13)* (*int*) :data:`xref` of the associated PDF portfolio item if any, else zero. - * *checksum* -- *(New in v1.18.13)* (*str*) a hashcode of the stored file content as a hexadecimal string. Should be MD5 according to PDF specifications, but be prepared to see other hashing algorithms. + * ``name`` -- (*str*) name under which this entry is stored + * ``filename`` -- (*str*) filename + * ``ufilename`` -- (*unicode*) filename + * ``description`` -- (*str*) description + * ``size`` -- (*int*) original file size + * ``length`` -- (*int*) compressed file length + * ``creationDate`` -- (*str*) date-time of item creation in PDF format + * ``modDate`` -- (*str*) date-time of last change in PDF format + * ``collection`` -- (*int*) :data:`xref` of the associated PDF portfolio item if any, else zero. + * ``checksum`` -- (*str*) a hashcode of the stored file content as a hexadecimal string. Should be MD5 according to PDF specifications, but be prepared to see other hashing algorithms. .. method:: embfile_names() - * New in v1.14.16 - PDF only: Return a list of embedded file names. The sequence of the names equals the physical sequence in the document. :rtype: list diff --git a/src/__init__.py b/src/__init__.py index bd66a643e..3db0bf3f3 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -912,7 +912,7 @@ def file_info(self): size = mupdf.pdf_to_int(o) res[ dictkey_filename] = JM_EscapeStrFromStr(filename) - res[ dictkey_desc] = JM_UnicodeFromStr(desc) + res[ dictkey_descr] = JM_UnicodeFromStr(desc) res[ dictkey_length] = length res[ dictkey_size] = size return res @@ -3255,7 +3255,7 @@ def _embfile_info(self, idx, infodict): infodict[dictkey_ufilename] = JM_EscapeStrFromStr(name) name = mupdf.pdf_to_text_string(mupdf.pdf_dict_get(o, PDF_NAME('Desc'))) - infodict[dictkey_desc] = JM_UnicodeFromStr(name) + infodict[dictkey_descr] = JM_UnicodeFromStr(name) len_ = -1 DL = -1 @@ -13668,7 +13668,7 @@ class EmptyFileError(FileDataError): dictkey_cs_name = "cs-name" dictkey_da = "da" dictkey_dashes = "dashes" -dictkey_desc = "desc" +dictkey_descr = "description" dictkey_desc = "descender" dictkey_dir = "dir" dictkey_effect = "effect" diff --git a/tests/test_annots.py b/tests/test_annots.py index ff4f92e12..8d18c30e1 100644 --- a/tests/test_annots.py +++ b/tests/test_annots.py @@ -343,8 +343,8 @@ def test_file_info(): print(f'{file_info=}') results.append(file_info) assert results == [ - {'filename': 'example.pdf', 'descender': '', 'length': 8416, 'size': 8992}, - {'filename': 'photo1.jpeg', 'descender': '', 'length': 10154, 'size': 8012}, + {'filename': 'example.pdf', 'description': '', 'length': 8416, 'size': 8992}, + {'filename': 'photo1.jpeg', 'description': '', 'length': 10154, 'size': 8012}, ] def test_3131():