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

Function create_label_str

src_classic/utils.py:4912–4928  ·  view source on GitHub ↗

Convert Python label dict to correspnding PDF rule string. Args: label: (dict) build rule for the label. Returns: PDF label rule string wrapped in "<<", ">>".

(label)

Source from the content-addressed store, hash-verified

4910 # William Chapman, 2021-01-06
4911
4912 def create_label_str(label):
4913 """Convert Python label dict to correspnding PDF rule string.
4914
4915 Args:
4916 label: (dict) build rule for the label.
4917 Returns:
4918 PDF label rule string wrapped in "<<", ">>".
4919 """
4920 s = "%i<<" % label["startpage"]
4921 if label.get("prefix", "") != "":
4922 s += "/P(%s)" % label["prefix"]
4923 if label.get("style", "") != "":
4924 s += "/S/%s" % label["style"]
4925 if label.get("firstpagenum", 1) > 1:
4926 s += "/St %i" % label["firstpagenum"]
4927 s += ">>"
4928 return s
4929
4930 def create_nums(labels):
4931 """Return concatenated string of all labels rules.

Callers 2

create_numsMethod · 0.85
create_numsFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…