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

Method set_align

src/__init__.py:2474–2489  ·  view source on GitHub ↗

Set text alignment via CSS style

(self, align)

Source from the content-addressed store, hash-verified

2472 return Xml( mupdf.fz_xml_root( self.this))
2473
2474 def set_align(self, align):
2475 """Set text alignment via CSS style"""
2476 if isinstance( align, str):
2477 t = align
2478 elif align == TEXT_ALIGN_LEFT:
2479 t = "left"
2480 elif align == TEXT_ALIGN_CENTER:
2481 t = "center"
2482 elif align == TEXT_ALIGN_RIGHT:
2483 t = "right"
2484 elif align == TEXT_ALIGN_JUSTIFY:
2485 t = "justify"
2486 else:
2487 raise ValueError(f"Unrecognised {align=}")
2488 self.add_style(f"text-align: {t}")
2489 return self
2490
2491 def set_attribute( self, key, value):
2492 assert key

Callers 3

set_propertiesMethod · 0.80
code_printerFunction · 0.80
simple-grid.pyFile · 0.80

Calls 1

add_styleMethod · 0.95

Tested by

no test coverage detected