MCPcopy Index your code
hub / github.com/pymupdf/PyMuPDF / insert_page

Method insert_page

src/__init__.py:5358–5386  ·  view source on GitHub ↗

Create a new PDF page and insert some text. Notes: Function combining pymupdf.Document.new_page() and pymupdf.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

5356 )
5357
5358 def insert_page(
5359 doc: 'Document',
5360 pno: int,
5361 text: typing.Union[str, list, None] = None,
5362 fontsize: float = 11,
5363 width: float = 595,
5364 height: float = 842,
5365 fontname: str = "helv",
5366 fontfile: OptStr = None,
5367 color: OptSeq = (0,),
5368 ) -> int:
5369 """Create a new PDF page and insert some text.
5370
5371 Notes:
5372 Function combining pymupdf.Document.new_page() and pymupdf.Page.insert_text().
5373 For parameter details see these methods.
5374 """
5375 page = doc.new_page(pno=pno, width=width, height=height)
5376 if not bool(text):
5377 return 0
5378 rc = page.insert_text(
5379 (50, 72),
5380 text,
5381 fontsize=fontsize,
5382 fontname=fontname,
5383 fontfile=fontfile,
5384 color=color,
5385 )
5386 return rc
5387
5388 def insert_pdf(
5389 self,

Callers

nothing calls this directly

Calls 2

new_pageMethod · 0.80
insert_textMethod · 0.45

Tested by

no test coverage detected