phihag/pdfform.js

Checkbox editing not workin

michaeldraga opened this issue · 7 comments

When you give a checkbox value of true, it doesn't get properly transformed by the library and just stays false. Does anyone know why that's happening?

@michaelb00m Are you assigning it to be a boolean inside of an array, e.g. field[value] = [true]?

@dsny-tech I just double checked by actually using true instead of a statement inside of the brackets and it changed nothing. Apart from that I just realized that this has to be a problem with the library since it doesn't work in the demo as well.

@michaelb00m You should also go into the PDF and see if the checkbox form field is exporting the value of "Yes" instead of "On" and it should work, at least it did for me using Adobe acrobat pro. And the [true] which is a boolean inside of an array.

@dsny-tech Alright, I finally got behind the problem. It appears that there was nothing wrong with the library but rather with Acrobat's language-specific way of handling input. As my host machine uses German, Adobe Acrobat decided to take 'Ja' (the German translation of 'Yes') as the checked property instead of the 'Yes' the library was outputting as a value. Hopefully, this will help other people get around that very annoying problem. If you run into it, check what your PDF viewer is using as the checked property.
Thanks for your help, though.

Cheers Michael

@dsny-tech Alright, I finally got behind the problem. It appears that there was nothing wrong with the library but rather with Acrobat's language-specific way of handling input. As my host machine uses German, Adobe Acrobat decided to take 'Ja' (the German translation of 'Yes') as the checked property instead of the 'Yes' the library was outputting as a value. Hopefully, this will help other people get around that very annoying problem. If you run into it, check what your PDF viewer is using as the checked property. Thanks for your help, though.

Cheers Michael

How to use pdfform.js with the checkbox pdf file?

@dsny-tech can you please share the code bcz I've tried this solution but still I'm facing same issue.

@dsny-tech can you please share the code bcz I've tried this solution but still I'm facing same issue.

I fixed the solution by change the line

n.map.AS = n.map.V = n.map.DV = value ? new minipdf_lib.Name('Yes') : new minipdf_lib.Name('Off');
to
n.map.DV = value ? new minipdf_lib.Name(value) : new minipdf_lib.Name('Off');