Skip to content

Write numeric form field values as PDF text strings - #1876

Merged
blikblum merged 1 commit into
foliojs:masterfrom
FFspiky:fix/numeric-form-values
Nov 24, 2026
Merged

blikblum merged 1 commit into
foliojs:masterfrom
FFspiky:fix/numeric-form-values

Conversation

@FFspiky

@FFspiky FFspiky commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

A bug fix for numeric AcroForm values. For example, doc.formText('amount', 10, 10, 120, 18, { value: 32.98, defaultValue: 0 }) produces a blank field in PDF.js and MuPDF. The same call with string inputs displays the amount. A combo field with options ['-2', '0', '1'] and numeric value -2 likewise loses its selection.

Store numeric values as PDF text strings, just as if the caller had provided strings. The generated text field now has /V (32.98) and /DV (0). Both readers recover the text and selected choice. PDF.js also reports both default values correctly.

Two unit assertions fail on master and pass with the fix. All 668 tests pass with two workers on macOS and Node 24.22.3, including the visual suite. The default parallel run hit the existing eight-second timeout on five visual cases. Prettier and ESLint pass.

OpenAI Codex assisted with implementation and testing.

Checklist

  • Unit tests
  • Documentation
  • Update CHANGELOG.md
  • Ready for review and merge

@blikblum
blikblum merged commit b017a07 into foliojs:master Nov 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants