pdf-lib icon indicating copy to clipboard operation
pdf-lib copied to clipboard

PDF Form Filling of NY CITY TAX FORM

Open msingla1990 opened this issue 4 years ago • 1 comments

What were you trying to do?

We are trying to Edit below pdf document for various form fields present in it. We are able to fill values in Textboxes, Dates, Checkbox fields which have unique names with no issue. But when we try to set the value of checkbox which have many occurrence in pdf & having same name then it's picking up only first occurrence.

For Example: When you open up this pdf document you will see 4 checkboxes in succession and all of these checkbox have same name="period": 1 2 3 4 Jan 1-[ ] Apr 1-[ ] July 1- [ ] Oct 1- [ ] Mar 31 Jun 30
Sep 30 Dec 31

URL of pdf template: http://199.231.86.172/Dev/NYS-45.pdf

How did you attempt to do it?

const checkBox = form.getCheckBox("period"); checkBox.check();

What actually happened?

it's checking only first checkbox.

What did you expect to happen?

We want a capability to find a specific checkbox out of multiple with same name & to be able to set it's value as well.

How can we reproduce the issue?

You can use the same template and try to check any of them.

Is there any way to handle checkboxes with same name so that we can check any of them.

Version

1.17.1

What environment are you running pdf-lib in?

Node

Checklist

  • [X] My report includes a Short, Self Contained, Correct (Compilable) Example.
  • [X] I have attached all PDFs, images, and other files needed to run my SSCCE.

Additional Notes

No response

msingla1990 avatar Jan 07 '22 12:01 msingla1990

Seconded. I found a way to check the child tags and check the corresponding one ( Example here: https://github.com/Hopding/pdf-lib/issues/1185#issuecomment-1069657650 ), But any checkbox except the first one is empty when the form is flattened.

satinjeet avatar Mar 17 '22 19:03 satinjeet