MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / xref_get_keys

Method xref_get_keys

src/__init__.py:7963–7980  ·  view source on GitHub ↗

Get the keys of PDF dict object at 'xref'. Use -1 for the PDF trailer.

(self, xref)

Source from the content-addressed store, hash-verified

7961 return (type, text)
7962
7963 def xref_get_keys(self, xref):
7964 """Get the keys of PDF dict object at 'xref'. Use -1 for the PDF trailer."""
7965 pdf = _as_pdf_document(self)
7966 xreflen = mupdf.pdf_xref_len( pdf)
7967 if not _INRANGE(xref, 1, xreflen-1) and xref != -1:
7968 raise ValueError( MSG_BAD_XREF)
7969 if xref > 0:
7970 obj = mupdf.pdf_load_object( pdf, xref)
7971 else:
7972 obj = mupdf.pdf_trailer( pdf)
7973 n = mupdf.pdf_dict_len( obj)
7974 rc = []
7975 if n == 0:
7976 return rc
7977 for i in range(n):
7978 key = mupdf.pdf_to_name( mupdf.pdf_dict_get_key( obj, i))
7979 rc.append(key)
7980 return rc
7981
7982 def xref_is_font(self, xref):
7983 """Check if xref is a font object."""

Callers 6

set_ocMethod · 0.80
xref_copyMethod · 0.80
set_ocFunction · 0.80
xref_copyFunction · 0.80
test_trailerFunction · 0.80
test_erase_metaFunction · 0.80

Calls 4

_as_pdf_documentFunction · 0.85
_INRANGEFunction · 0.85
pdf_trailerMethod · 0.80
appendMethod · 0.45

Tested by 2

test_trailerFunction · 0.64
test_erase_metaFunction · 0.64