Skip to content

Commit ee476a1

Browse files
committed
Update acroform example with addTextFieldGroup
1 parent aab094c commit ee476a1

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

examples/js/acroforms.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ var {
88
TextField,
99
PasswordField,
1010
RadioButton,
11-
Appearance
11+
Appearance,
12+
TextFieldParent
1213
} = jsPDF.AcroForm;
1314

1415
doc.setFontSize(12);
@@ -22,6 +23,7 @@ addPushButton();
2223
addTextField();
2324
addPasswordField();
2425
addRadioGroups();
26+
addTextFieldGroup();
2527

2628
function addComboBox() {
2729
doc.text("ComboBox:", 10, yPos);
@@ -143,4 +145,23 @@ function addRadioGroups() {
143145
radioButton23.AS = "/RadioGroup2Option3";
144146

145147
radioGroup2.setAppearance(Appearance.RadioButton.Circle);
148+
yPos += margin + boxDim;
149+
}
150+
151+
function addTextFieldGroup() {
152+
doc.text("TextField Group:", 10, yPos);
153+
154+
const txtDate = new TextFieldParent();
155+
txtDate.fieldName = "Date";
156+
txtDate.value = new Date().toLocaleDateString("en-US");
157+
txtDate.borderColor = [0];
158+
doc.addField(txtDate);
159+
160+
const txtDate1 = txtDate.createChild();
161+
txtDate1.Rect = [50, yPos - 5, 40, 10];
162+
163+
yPos += margin;
164+
165+
const txtDate2 = txtDate.createChild();
166+
txtDate2.Rect = [50, yPos - 5, 40, 10];
146167
}

0 commit comments

Comments
 (0)