-
-
Notifications
You must be signed in to change notification settings - Fork 579
Description
Relevant pdfcpu code
pdfcpu/pkg/pdfcpu/form/export.go
Line 277 in dfaa588
cb.Value = o.(types.Name) == "Yes" pdfcpu/pkg/pdfcpu/form/form.go
Line 390 in dfaa588
if o.(types.Name) == "Yes" {
Pseudo call graphs:
export.go
ExportFormJSON
ExportForm
exportPageFields
exportBtn
extractCheckbox
form.go
FormFields
collectFields
collectPageFields
collectPageField
collectBtn
Noticed the checkbox value problem when using pdfcpu as go library with ExportFormJSON function. Checkboxes that were checked in the PDF form resulted in checkboxes with value: false in the exported JSON. Reason for this was customized export value in the PDF. For example in Adobe Acrobat Pro, this would be defined in "Check Box Properties" - "Options" - "Export value". PDF forms created with different language might have different default value here, at least translated values of "Yes" were noticed on some PDFs we were processing.
Tried to bypass this issue by iterating checkbox fields manually via FormFields function, but codepath used here has the same issue of checking for hardcoded "Yes" value.
Patched around this issue by checking for custom values in pdfcpu code, but this is not really a general fix for the problem.