I am trying to fill checkbox programmatically in PDF form, using node-pdftk
and pdftk
. I have dumbed the field names and it's state options trying to fill it but no luck
$ pdftk some_pdf.pdf dump_data_fields_utf8
---
FieldType: Button
FieldName: Zaškrtávací pole 01
FieldFlags: 0
FieldJustification: Left
FieldStateOption: Ano0
FieldStateOption: Ano1
FieldStateOption: Ano2
FieldStateOption: Ano3
FieldStateOption: Ano4
FieldStateOption: Ano5
FieldStateOption: Ano6
FieldStateOption: Off
trying to set it using:
pdftk
.input(originalPdfPath)
.fillForm({
'Zaškrtávací pole 01' : 'Ano0',
'Textové pole3' : 'Test using UTF8 field name',
})
.output()
.then(buffer => {
return buffer;
}).catch((e) => {
console.error(e)
})
The textfield 'Textové pole3'
gets filled, just checkbox doesn't.
Also I tried to rename the FieldName
to field1
and set it again but no luck either.
No error in console or server.
How do I "check" that field?
So at the end i made my own lib to work with filling pdf acroforms
https://www.npmjs.com/package/pdftk-fill-pdf
including checkboxes