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

Method xref_stream_raw

src/__init__.py:8096–8112  ·  view source on GitHub ↗

Get xref stream without decompression.

(self, xref)

Source from the content-addressed store, hash-verified

8094 return r
8095
8096 def xref_stream_raw(self, xref):
8097 """Get xref stream without decompression."""
8098 if self.is_closed or self.is_encrypted:
8099 raise ValueError("document closed or encrypted")
8100 pdf = _as_pdf_document(self)
8101 xreflen = mupdf.pdf_xref_len( pdf)
8102 if not _INRANGE(xref, 1, xreflen-1) and xref != -1:
8103 raise ValueError( MSG_BAD_XREF)
8104 if xref >= 0:
8105 obj = mupdf.pdf_new_indirect( pdf, xref, 0)
8106 else:
8107 obj = mupdf.pdf_trailer( pdf)
8108 r = None
8109 if mupdf.pdf_is_stream( obj):
8110 res = mupdf.pdf_load_raw_stream_number( pdf, xref)
8111 r = JM_BinFromBuffer( res)
8112 return r
8113
8114 def xref_xml_metadata(self):
8115 """Get xref of document XML metadata."""

Callers 2

xref_copyMethod · 0.80
xref_copyFunction · 0.80

Calls 4

_as_pdf_documentFunction · 0.85
_INRANGEFunction · 0.85
JM_BinFromBufferFunction · 0.85
pdf_trailerMethod · 0.80

Tested by

no test coverage detected