Skip to content

Commit ab09a8c

Browse files
committed
feat: add mark checkboxes as yes example
1 parent 2df2277 commit ab09a8c

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import type { Instance } from "@nutrient-sdk/viewer";
2+
import { baseOptions } from "../../shared/base-options";
3+
4+
window.NutrientViewer.load({
5+
...baseOptions,
6+
toolbarItems: [
7+
...window.NutrientViewer.defaultToolbarItems,
8+
{ type: "form-creator" },
9+
],
10+
}).then(async (instance: Instance) => {
11+
const formFields = await instance.getFormFields();
12+
13+
for (const formField of formFields) {
14+
if (
15+
formField instanceof window.NutrientViewer.FormFields.CheckBoxFormField
16+
) {
17+
await instance.setFormFieldValues({
18+
[formField.name]: ["Yes"],
19+
});
20+
}
21+
}
22+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
category: forms
3+
title: Mark All Checkboxes
4+
description: Programmatically check all checkbox form fields in a PDF document.
5+
keywords: [forms, checkbox, form-field, automation]
6+
---

0 commit comments

Comments
 (0)