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

Function JM_listbox_value

src/__init__.py:20454–20475  ·  view source on GitHub ↗

ListBox retrieve value

( annot)

Source from the content-addressed store, hash-verified

20452 return mupdf.fz_make_irect(f[0], f[1], f[2], f[3])
20453
20454def JM_listbox_value( annot):
20455 '''
20456 ListBox retrieve value
20457 '''
20458 # may be single value or array
20459 annot_obj = mupdf.pdf_annot_obj( annot)
20460 optarr = mupdf.pdf_dict_get( annot_obj, PDF_NAME('V'))
20461 if mupdf.pdf_is_string( optarr): # a single string
20462 return mupdf.pdf_to_text_string( optarr)
20463
20464 # value is an array (may have len 0)
20465 n = mupdf.pdf_array_len( optarr)
20466 liste = []
20467
20468 # extract a list of strings
20469 # each entry may again be an array: take second entry then
20470 for i in range( n):
20471 elem = mupdf.pdf_array_get( optarr, i)
20472 if mupdf.pdf_is_array( elem):
20473 elem = mupdf.pdf_array_get( elem, 1)
20474 liste.append( JM_UnicodeFromStr( mupdf.pdf_to_text_string( elem)))
20475 return liste
20476
20477
20478def JM_make_annot_DA(annot, ncol, col, fontname, fontsize):

Callers

nothing calls this directly

Calls 3

PDF_NAMEFunction · 0.85
JM_UnicodeFromStrFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…