jjwilly16 / node-pdftk

A wrapper for PDF Toolkit with streams and promises.
MIT License
141 stars 34 forks source link

Cannot set the checkbox when filling PDF. #25

Closed maielo closed 5 years ago

maielo commented 5 years ago

Describe the bug Cannot set the checkbox when filling PDF.

To Reproduce I have dumbed the avalaible fields.

$ 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)
            })

Expected behavior Fill the checkbox

Desktop (please complete the following information):

jjwilly16 commented 5 years ago

Try setting the checkbox value to 'Yes'. See an explanation here.

icodeforlove commented 4 years ago

@jjwilly16 that actually worked