Open jelizarovas opened 2 years ago
i didn't solve the problem with remove multiline form field
so i removed all forms with
const form = pdfDoc.getForm();
form flatten();
more details here https://pdf-lib.js.org/docs/api/classes/pdfform#flatten maybe it will be useful for someone
I found a solution which might work also for you
while (field.acroField.getWidgets().length) {
field.acroField.removeWidget(0);
}
form.removeField(field);
I found a solution which might work also for you
while (field.acroField.getWidgets().length) { field.acroField.removeWidget(0); } form.removeField(field);
Thanks This allowed me to remove all types of fields
I found a solution which might work also for you
while (field.acroField.getWidgets().length) { field.acroField.removeWidget(0); } form.removeField(field);
Excellent 👍 Thank you!!
I found a solution which might work also for you
while (field.acroField.getWidgets().length) { field.acroField.removeWidget(0); } form.removeField(field);
OMG yes! I owe you.
What were you trying to do?
I am trying to merge pdf documents with form fields. It does not work with forms very well as they become very unstable in the merge document, or disappear. My workaround is to get all of the form data, strip all the form fields, merge all the documents and try to apply the form data back on the merged document. Multiline text fields fail on
form.removeField(field)
How did you attempt to do it?
Running
node v14.18.3
multiline.pdfWhat actually happened?
What did you expect to happen?
Remove multi line text field.
How can we reproduce the issue?
Run multiline.pdf With my function, and it will produce an error
Version
1.17.1
What environment are you running pdf-lib in?
Node
Checklist
Additional Notes
No response