MCPcopy Create free account
hub / github.com/ading2210/linuxpdf / create_field

Function create_field

gen_pdf.py:29–49  ·  view source on GitHub ↗
(name, x, y, width, height, value="", f_type=PdfName.Tx)

Source from the content-addressed store, hash-verified

27 return page
28
29def create_field(name, x, y, width, height, value="", f_type=PdfName.Tx):
30 annotation = PdfDict()
31 annotation.Type = PdfName.Annot
32 annotation.Subtype = PdfName.Widget
33 annotation.FT = f_type
34 annotation.Ff = 2
35 annotation.Rect = PdfArray([x, y, x + width, y + height])
36 annotation.T = PdfString.encode(name)
37 annotation.V = PdfString.encode(value)
38
39 annotation.BS = PdfDict()
40 annotation.BS.W = 0
41
42 appearance = PdfDict()
43 appearance.Type = PdfName.XObject
44 appearance.SubType = PdfName.Form
45 appearance.FormType = 1
46 appearance.BBox = PdfArray([0, 0, width, height])
47 appearance.Matrix = PdfArray([1.0, 0.0, 0.0, 1.0, 0.0, 0.0])
48
49 return annotation
50
51def create_text(x, y, size, txt):
52 return f"""

Callers 2

create_buttonFunction · 0.85
gen_pdf.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected