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

Method move_page

src/__init__.py:5831–5849  ·  view source on GitHub ↗

Move a page within a PDF document. Args: pno: source page number. to: put before this page, '-1' means after last page.

(self, pno: int, to: int =-1)

Source from the content-addressed store, hash-verified

5829 return valid
5830
5831 def move_page(self, pno: int, to: int =-1):
5832 """Move a page within a PDF document.
5833
5834 Args:
5835 pno: source page number.
5836 to: put before this page, '-1' means after last page.
5837 """
5838 if self.is_closed:
5839 raise ValueError("document closed")
5840 page_count = len(self)
5841 if (pno not in range(page_count) or to not in range(-1, page_count)):
5842 raise ValueError("bad page number(s)")
5843 before = 1
5844 copy = 0
5845 if to == -1:
5846 to = page_count - 1
5847 before = 0
5848
5849 return self._move_copy_page(pno, to, before, copy)
5850
5851 @property
5852 def name(self):

Callers 2

test_deletionFunction · 0.80
code-printer.pyFile · 0.80

Calls 1

_move_copy_pageMethod · 0.95

Tested by 1

test_deletionFunction · 0.64