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

Method update

src/__init__.py:9307–9335  ·  view source on GitHub ↗

Reflect Python object in the PDF.

(self, sync_flags=False)

Source from the content-addressed store, hash-verified

9305 TOOLS._reset_widget(self._annot)
9306
9307 def update(self, sync_flags=False):
9308 """Reflect Python object in the PDF."""
9309 self._validate()
9310
9311 self._adjust_font() # ensure valid text_font name
9312
9313 # now create the /DA string
9314 self._text_da = ""
9315 if len(self.text_color) == 3:
9316 fmt = "{:g} {:g} {:g} rg /{f:s} {s:g} Tf" + self._text_da
9317 elif len(self.text_color) == 1:
9318 fmt = "{:g} g /{f:s} {s:g} Tf" + self._text_da
9319 elif len(self.text_color) == 4:
9320 fmt = "{:g} {:g} {:g} {:g} k /{f:s} {s:g} Tf" + self._text_da
9321 self._text_da = fmt.format(*self.text_color, f=self.text_font,
9322 s=self.text_fontsize)
9323 # finally update the widget
9324
9325 # if widget has a '/AA/C' script, make sure it is in the '/CO'
9326 # array of the '/AcroForm' dictionary.
9327 if self.script_calc: # there is a "calculation" script:
9328 # make sure we are in the /CO array
9329 util_ensure_widget_calc(self._annot)
9330
9331 # finally update the widget
9332 TOOLS._save_widget(self._annot, self)
9333 self._text_da = ""
9334 if sync_flags:
9335 self._sync_flags() # propagate field flags to parent and kids
9336
9337
9338from . import _extra

Callers 1

test_checkboxFunction · 0.95

Calls 5

_validateMethod · 0.95
_adjust_fontMethod · 0.95
_sync_flagsMethod · 0.95
util_ensure_widget_calcFunction · 0.85
_save_widgetMethod · 0.80

Tested by 1

test_checkboxFunction · 0.76