I need to get the properties value of "Export Value" out of checkbox fields in PDF file, I using 'pdf-lib', and according to the code in the repo I should get it by using:
const pdfDoc = await PDFDocument.load(pdfBytes);
const form = pdfDoc.getForm();
const fields = form.getFields();
const field = field[0];
const exportValue = field.acroField.getExportValues()
But it always return undefined...
It is possible to get the value of a checkBox but pdf-lib simply treats them as true of false (checked or unchecked). To go deeper into the underlying values will need a much more complex method of PDF query.
Where "checkbox" is this. doc known field /Tagged "name" and /V is its binary value (true/false, on/off, yes/no or ja/nein)
So here we can use one of the examples to test and even alter another field based on the checkbox status. https://jsfiddle.net/f8L4u95e/2/
With
similar with those reversed
for wider discussions see Do checkbox inputs only post data if they're checked?