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

Method update_object

src/__init__.py:7776–7789  ·  view source on GitHub ↗

Replace object definition source.

(self, xref, text, page=None)

Source from the content-addressed store, hash-verified

7774 mupdf.ll_pdf_read_ocg( pdf.m_internal)
7775
7776 def update_object(self, xref, text, page=None):
7777 """Replace object definition source."""
7778 if self.is_closed or self.is_encrypted:
7779 raise ValueError("document closed or encrypted")
7780 pdf = _as_pdf_document(self)
7781 xreflen = mupdf.pdf_xref_len(pdf)
7782 if not _INRANGE(xref, 1, xreflen-1):
7783 RAISEPY("bad xref", MSG_BAD_XREF)
7784 ENSURE_OPERATION(pdf)
7785 # create new object with passed-in string
7786 new_obj = JM_pdf_obj_from_str(pdf, text)
7787 mupdf.pdf_update_object(pdf, xref, new_obj)
7788 if page:
7789 JM_refresh_links( _as_pdf_page(page))
7790
7791 def update_stream(self, xref=0, stream=None, new=1, compress=1):
7792 """Replace xref stream part."""

Callers 15

_set_page_labelsMethod · 0.95
scrubMethod · 0.80
set_metadataMethod · 0.80
set_ocmdMethod · 0.80
set_tocMethod · 0.80
set_subset_fontnameMethod · 0.80
subset_fontsMethod · 0.80
update_linkMethod · 0.80
set_metadataFunction · 0.80
set_tocFunction · 0.80
update_linkFunction · 0.80
scrubFunction · 0.80

Calls 7

_as_pdf_documentFunction · 0.85
_INRANGEFunction · 0.85
RAISEPYFunction · 0.85
ENSURE_OPERATIONFunction · 0.85
JM_pdf_obj_from_strFunction · 0.85
JM_refresh_linksFunction · 0.85
_as_pdf_pageFunction · 0.85

Tested by 2

test_2556Function · 0.64
test_4702Function · 0.64