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

Method pages

src/__init__.py:6036–6063  ·  view source on GitHub ↗

Return a generator iterator over a page range. Arguments have the same meaning as for the range() built-in.

(self, start: OptInt =None, stop: OptInt =None, step: OptInt =None)

Source from the content-addressed store, hash-verified

6034 return "UseNone"
6035
6036 def pages(self, start: OptInt =None, stop: OptInt =None, step: OptInt =None) -> collections.abc.Iterable[Page]:
6037 """Return a generator iterator over a page range.
6038
6039 Arguments have the same meaning as for the range() built-in.
6040 """
6041 if not self.page_count:
6042 return
6043 # set the start value
6044 start = start or 0
6045 while start < 0:
6046 start += self.page_count
6047 if start not in range(self.page_count):
6048 raise ValueError("bad start page number")
6049
6050 # set the stop value
6051 stop = stop if stop is not None and stop <= self.page_count else self.page_count
6052
6053 # set the step value
6054 if step == 0:
6055 raise ValueError("arg 3 must not be zero")
6056 if step is None:
6057 if start > stop:
6058 step = -1
6059 else:
6060 step = 1
6061
6062 for pno in range(start, stop, step):
6063 yield (self.load_page(pno))
6064
6065 def pdf_catalog(self):
6066 """Get xref of PDF catalog."""

Callers 6

test_bug1971Function · 0.95
test_text2Function · 0.80
test_3594Function · 0.80
test_4018Function · 0.80
test_4224Function · 0.80
test_2907Function · 0.80

Calls 1

load_pageMethod · 0.95

Tested by 6

test_bug1971Function · 0.76
test_text2Function · 0.64
test_3594Function · 0.64
test_4018Function · 0.64
test_4224Function · 0.64
test_2907Function · 0.64