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

Method _getPageInfo

src/__init__.py:3931–3949  ·  view source on GitHub ↗

List fonts, images, XObjects used on a page.

(self, pno, what)

Source from the content-addressed store, hash-verified

3929 return idlist
3930
3931 def _getPageInfo(self, pno, what):
3932 """List fonts, images, XObjects used on a page."""
3933 if self.is_closed or self.is_encrypted:
3934 raise ValueError("document closed or encrypted")
3935 doc = self.this
3936 pageCount = mupdf.pdf_count_pages(doc) if isinstance(doc, mupdf.PdfDocument) else mupdf.fz_count_pages(doc)
3937 n = pno # pno < 0 is allowed
3938 while n < 0:
3939 n += pageCount # make it non-negative
3940 if n >= pageCount:
3941 raise ValueError( MSG_BAD_PAGENO)
3942 pdf = _as_pdf_document(self)
3943 pageref = mupdf.pdf_lookup_page_obj(pdf, n)
3944 rsrc = mupdf.pdf_dict_get_inheritable(pageref, mupdf.PDF_ENUM_NAME_Resources)
3945 liste = []
3946 tracer = []
3947 if rsrc.m_internal:
3948 JM_scan_resources(pdf, rsrc, liste, what, 0, tracer)
3949 return liste
3950
3951 def _insert_font(self, fontfile=None, fontbuffer=None):
3952 ''&#x27;

Callers 3

get_page_fontsMethod · 0.95
get_page_imagesMethod · 0.95
get_page_xobjectsMethod · 0.95

Calls 2

_as_pdf_documentFunction · 0.85
JM_scan_resourcesFunction · 0.85

Tested by

no test coverage detected