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

Method get_oc_items

src/__init__.py:12086–12103  ·  view source on GitHub ↗

Get OCGs and OCMDs used in the page's contents. Returns: List of items (name, xref, type), where type is one of "ocg" / "ocmd", and name is the property name.

(self)

Source from the content-addressed store, hash-verified

12084 return self.parent.get_page_images(self.number, full=full)
12085
12086 def get_oc_items(self) -> list:
12087 """Get OCGs and OCMDs used in the page's contents.
12088
12089 Returns:
12090 List of items (name, xref, type), where type is one of "ocg" / "ocmd",
12091 and name is the property name.
12092 """
12093 rc = []
12094 for pname, xref in self._get_resource_properties():
12095 text = self.parent.xref_object(xref, compressed=True)
12096 if "/Type/OCG" in text:
12097 octype = "ocg"
12098 elif "/Type/OCMD" in text:
12099 octype = "ocmd"
12100 else:
12101 continue
12102 rc.append((pname, xref, octype))
12103 return rc
12104
12105 def get_svg_image(self, matrix=None, text_as_path=1):
12106 """Make SVG image from page."""

Callers 1

test_oc2Function · 0.80

Calls 3

xref_objectMethod · 0.80
appendMethod · 0.45

Tested by 1

test_oc2Function · 0.64