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

Method markinfo

src/__init__.py:5802–5829  ·  view source on GitHub ↗

Return the PDF MarkInfo value.

(self)

Source from the content-addressed store, hash-verified

5800
5801 @property
5802 def markinfo(self) -> dict:
5803 """Return the PDF MarkInfo value."""
5804 xref = self.pdf_catalog()
5805 if xref == 0:
5806 return None
5807 rc = self.xref_get_key(xref, "MarkInfo")
5808 if rc[0] == "null":
5809 return {}
5810 if rc[0] == "xref":
5811 xref = int(rc[1].split()[0])
5812 val = self.xref_object(xref, compressed=True)
5813 elif rc[0] == "dict":
5814 val = rc[1]
5815 else:
5816 val = None
5817 if val is None or not (val[:2] == "<<" and val[-2:] == ">>"):
5818 return {}
5819 valid = {"Marked": False, "UserProperties": False, "Suspects": False}
5820 val = val[2:-2].split("/")
5821 for v in val[1:]:
5822 try:
5823 key, value = v.split()
5824 except Exception:
5825 if g_exceptions_verbose > 1: exception_info()
5826 return valid
5827 if value == "true":
5828 valid[key] = True
5829 return valid
5830
5831 def move_page(self, pno: int, to: int =-1):
5832 """Move a page within a PDF document.

Callers

nothing calls this directly

Calls 4

pdf_catalogMethod · 0.95
xref_get_keyMethod · 0.95
xref_objectMethod · 0.95
exception_infoFunction · 0.85

Tested by

no test coverage detected