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

Method set_layer_ui_config

src/__init__.py:6855–6870  ·  view source on GitHub ↗

Set / unset OC intent configuration.

(self, number, action=0)

Source from the content-addressed store, hash-verified

6853 mupdf.ll_pdf_read_ocg( pdf.m_internal)
6854
6855 def set_layer_ui_config(self, number, action=0):
6856 """Set / unset OC intent configuration."""
6857 # The user might have given the name instead of sequence number,
6858 # so select by that name and continue with corresp. number
6859 if isinstance(number, str):
6860 select = [ui["number"] for ui in self.layer_ui_configs() if ui["text"] == number]
6861 if select == []:
6862 raise ValueError(f"bad OCG '{number}'.")
6863 number = select[0] # this is the number for the name
6864 pdf = _as_pdf_document(self)
6865 if action == 1:
6866 mupdf.pdf_toggle_layer_config_ui(pdf, number)
6867 elif action == 2:
6868 mupdf.pdf_deselect_layer_config_ui(pdf, number)
6869 else:
6870 mupdf.pdf_select_layer_config_ui(pdf, number)
6871
6872 def set_markinfo(self, markinfo: dict) -> bool:
6873 """Set the PDF MarkInfo values."""

Callers 1

test_4479Function · 0.80

Calls 2

layer_ui_configsMethod · 0.95
_as_pdf_documentFunction · 0.85

Tested by 1

test_4479Function · 0.64