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

Method xref_stream

src/__init__.py:8078–8094  ·  view source on GitHub ↗

Get decompressed xref stream.

(self, xref)

Source from the content-addressed store, hash-verified

8076 )
8077
8078 def xref_stream(self, xref):
8079 """Get decompressed xref stream."""
8080 if self.is_closed or self.is_encrypted:
8081 raise ValueError("document closed or encrypted")
8082 pdf = _as_pdf_document(self)
8083 xreflen = mupdf.pdf_xref_len( pdf)
8084 if not _INRANGE(xref, 1, xreflen-1) and xref != -1:
8085 raise ValueError( MSG_BAD_XREF)
8086 if xref >= 0:
8087 obj = mupdf.pdf_new_indirect( pdf, xref, 0)
8088 else:
8089 obj = mupdf.pdf_trailer( pdf)
8090 r = None
8091 if mupdf.pdf_is_stream( obj):
8092 res = mupdf.pdf_load_stream_number( pdf, xref)
8093 r = JM_BinFromBuffer( res)
8094 return r
8095
8096 def xref_stream_raw(self, xref):
8097 """Get xref stream without decompression."""

Callers 2

scrubMethod · 0.80
scrubFunction · 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