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

Function test_text

tests/test_widgets.py:24–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22
23
24def test_text():
25 doc = pymupdf.open()
26 page = doc.new_page()
27 widget = pymupdf.Widget() # create a widget object
28 widget.border_color = blue # border color
29 widget.border_width = 0.3 # border width
30 widget.border_style = "d"
31 widget.border_dashes = (2, 3)
32 widget.field_name = "Textfield-1" # field name
33 widget.field_label = "arbitrary text - e.g. to help filling the field"
34 widget.field_type = pymupdf.PDF_WIDGET_TYPE_TEXT # field type
35 widget.fill_color = gold # field background
36 widget.rect = rect # set field rectangle
37 widget.text_color = blue # rext color
38 widget.text_font = "TiRo" # use font Times-Roman
39 widget.text_fontsize = fontsize # set fontsize
40 widget.text_maxlen = 50 # restrict number of characters
41 widget.field_value = "Times-Roman"
42 page.add_widget(widget) # create the field
43 field = page.first_widget
44 assert field.field_type_string == "Text"
45
46
47def test_checkbox():

Callers

nothing calls this directly

Calls 2

new_pageMethod · 0.80
add_widgetMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…