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

Function insert_page

src_classic/utils.py:1862–1890  ·  view source on GitHub ↗

Create a new PDF page and insert some text. Notes: Function combining Document.new_page() and Page.insert_text(). For parameter details see these methods.

(
    doc: Document,
    pno: int,
    text: typing.Union[str, list, None] = None,
    fontsize: float = 11,
    width: float = 595,
    height: float = 842,
    fontname: str = "helv",
    fontfile: OptStr = None,
    color: OptSeq = (0,),
)

Source from the content-addressed store, hash-verified

1860
1861
1862def insert_page(
1863 doc: Document,
1864 pno: int,
1865 text: typing.Union[str, list, None] = None,
1866 fontsize: float = 11,
1867 width: float = 595,
1868 height: float = 842,
1869 fontname: str = "helv",
1870 fontfile: OptStr = None,
1871 color: OptSeq = (0,),
1872) -> int:
1873 """Create a new PDF page and insert some text.
1874
1875 Notes:
1876 Function combining Document.new_page() and Page.insert_text().
1877 For parameter details see these methods.
1878 """
1879 page = doc.new_page(pno=pno, width=width, height=height)
1880 if not bool(text):
1881 return 0
1882 rc = page.insert_text(
1883 (50, 72),
1884 text,
1885 fontsize=fontsize,
1886 fontname=fontname,
1887 fontfile=fontfile,
1888 color=color,
1889 )
1890 return rc
1891
1892
1893def draw_line(

Callers

nothing calls this directly

Calls 2

new_pageMethod · 0.80
insert_textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…