forked from vanielf/pdf-lib
-
Notifications
You must be signed in to change notification settings - Fork 56
Closed
Labels
Description
Describe your idea
- I have a checkbox.pdf with two check box groups.
- check boxes in each group have same name but different export values.
- How can I check checkbox based on their export value?
How could this be implemented?
- I am able to find the check box with the export value, but no idea how to check it using it's widget reference!!
if (field instanceof PDFCheckBox) {
const widgets = field.acroField.getWidgets();
for (const widget of widgets) {
const exportValue = widget
.getOnValue()
?.['encodedName'].replace(/^\//, '');
console.log(exportValue, ' ==> ', widget.getAppearanceState());
if (exportValue == value) {
// widget.setAppearances();
// check the check box using widget => no functionality available in pdf-lib as of now it seems
break;
}
}
}- May be we need some method to check a checkbox using widget reference!
What problem are you trying to solve?
check the checkboxes based on the export values when all checkbox have same name.
Why does this matter to you?
- We have a product that helps customer to fill fillable pdfs.
- The requirement is customer wants to check checkbox 2 in first group & checkbox 1 in 2nd group. As all checkbox of first group have same names but different export values; same for 2nd group as well.
Would others find this helpful?
- It's useful when filling a fillable pdf having checkbox group with same names & different export values.
- Others will also find it useful.
Are you interested in implementing your proposal?
Yes
Why are you submitting a proposal?
shared in How could this be implemented?
Additional Notes
No response