Skip to content

Only checkboxes with value "Yes" are detected as value: true in JSON export #819

@simosdev

Description

@simosdev

Relevant pdfcpu code

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions