MCPcopy Index your code
hub / github.com/pymupdf/PyMuPDF / xref_object

Method xref_object

src/__init__.py:8021–8038  ·  view source on GitHub ↗

Get xref object source as a string.

(self, xref, compressed=0, ascii=0)

Source from the content-addressed store, hash-verified

8019 return xreflen
8020
8021 def xref_object(self, xref, compressed=0, ascii=0):
8022 """Get xref object source as a string."""
8023 if self.is_closed:
8024 raise ValueError("document closed")
8025 if g_use_extra:
8026 ret = extra.xref_object( self.this, xref, compressed, ascii)
8027 return ret
8028 pdf = _as_pdf_document(self)
8029 xreflen = mupdf.pdf_xref_len(pdf)
8030 if not _INRANGE(xref, 1, xreflen-1) and xref != -1:
8031 raise ValueError( MSG_BAD_XREF)
8032 if xref > 0:
8033 obj = mupdf.pdf_load_object(pdf, xref)
8034 else:
8035 obj = mupdf.pdf_trailer(pdf)
8036 res = JM_object_to_buffer(mupdf.pdf_resolve_indirect(obj), compressed, ascii)
8037 text = JM_EscapeStrFromBuffer(res)
8038 return text
8039
8040 def xref_set_key(self, xref, key, value):
8041 """Set the value of a PDF dictionary key."""

Callers 15

_set_page_labelsMethod · 0.95
markinfoMethod · 0.95
pdf_trailerMethod · 0.95
print_xrefFunction · 0.80
get_ocmdMethod · 0.80
scrubMethod · 0.80
set_ocmdMethod · 0.80
set_subset_fontnameMethod · 0.80
get_fontnamesMethod · 0.80
subset_fontsMethod · 0.80
button_statesMethod · 0.80
_get_optional_contentMethod · 0.80

Calls 5

_as_pdf_documentFunction · 0.85
_INRANGEFunction · 0.85
JM_object_to_bufferFunction · 0.85
JM_EscapeStrFromBufferFunction · 0.85
pdf_trailerMethod · 0.80

Tested by 6

test_objectstream1Function · 0.64
test_objectstream2Function · 0.64
test_objectstream3Function · 0.64
test_subset_fontsFunction · 0.64
test_4702Function · 0.64
getFunction · 0.64