Repository navigation
Write numeric form field values as PDF text strings - #1876
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-2likewise 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