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

Function insert_text

src_classic/utils.py:1797–1840  ·  view source on GitHub ↗
(
    page: Page,
    point: point_like,
    text: typing.Union[str, list],
    fontsize: float = 11,
    lineheight: OptFloat = None,
    fontname: str = "helv",
    fontfile: OptStr = None,
    set_simple: int = 0,
    encoding: int = 0,
    color: OptSeq = None,
    fill: OptSeq = None,
    border_width: float = 0.05,
    render_mode: int = 0,
    rotate: int = 0,
    morph: OptSeq = None,
    overlay: bool = True,
    stroke_opacity: float = 1,
    fill_opacity: float = 1,
    oc: int = 0,
)

Source from the content-addressed store, hash-verified

1795
1796
1797def insert_text(
1798 page: Page,
1799 point: point_like,
1800 text: typing.Union[str, list],
1801 fontsize: float = 11,
1802 lineheight: OptFloat = None,
1803 fontname: str = "helv",
1804 fontfile: OptStr = None,
1805 set_simple: int = 0,
1806 encoding: int = 0,
1807 color: OptSeq = None,
1808 fill: OptSeq = None,
1809 border_width: float = 0.05,
1810 render_mode: int = 0,
1811 rotate: int = 0,
1812 morph: OptSeq = None,
1813 overlay: bool = True,
1814 stroke_opacity: float = 1,
1815 fill_opacity: float = 1,
1816 oc: int = 0,
1817):
1818 img = page.new_shape()
1819 rc = img.insert_text(
1820 point,
1821 text,
1822 fontsize=fontsize,
1823 lineheight=lineheight,
1824 fontname=fontname,
1825 fontfile=fontfile,
1826 set_simple=set_simple,
1827 encoding=encoding,
1828 color=color,
1829 fill=fill,
1830 border_width=border_width,
1831 render_mode=render_mode,
1832 rotate=rotate,
1833 morph=morph,
1834 stroke_opacity=stroke_opacity,
1835 fill_opacity=fill_opacity,
1836 oc=oc,
1837 )
1838 if rc >= 0:
1839 img.commit(overlay)
1840 return rc
1841
1842
1843def new_page(

Callers

nothing calls this directly

Calls 3

new_shapeMethod · 0.80
insert_textMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…