PDF form field displayed as number instead of text
Categories
(Firefox :: PDF Viewer, defect, P3)
Tracking
()
People
(Reporter: christoph.kovacs, Assigned: calixte)
References
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Steps to reproduce:
Open a pdf form with a pre-filled out text field value of "165.000,00 €" (European separators)
Actual results:
FF PDF viewer shows "165,00", therefore seems to wrongly interpret the text as a number.
Expected results:
FF PDF viewer should show "165.000,00 €", since it is a text field and no auto-conversion into number should take place.
The field properties have been extracted as follows:
FieldType: Text
FieldName: JU_eur
FieldFlags: 8388609 (decimal)
FieldValue: 165.000,00 €
FieldJustification: Right
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::PDF Viewer' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
| Assignee | ||
Comment 2•3 years ago
|
||
:Christoph Kovacs, could you attach the pdf to this bug please ?
| Reporter | ||
Comment 3•3 years ago
|
||
Shows wrong number when opened with FF PDF Viewer. Should read "165.000,00 €" and "17.020,00 €" respectively. Instead shows "165,00" and "17,02"
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Comment 4•3 years ago
|
||
The pdf is kind of ill-formatted.
The first field contains the value 165.000,00 € which is not a number but a string representing a number with a unit.
Out of curiosity, I modified the flag to make the field modifiable and it isn't really modifiable: each time I press a key nothing is changed because the potential change leads to an invalid number hence the change is cancelled (the only way to modify the field is to select enough chars to just keep a number and then remove them in hitting the delete key).
So the field V entry should just contain 165000 and the format code should be AFNumber_Format(2, 2, 0, 0, " \u20ac", false); in order to format it correctly (and the AP entry should have the correct appearance).
When a pdf is open we run the all the format actions for each field:
https://github.com/mozilla/pdf.js/blob/09da8026b6fd803d60451aaf0aa8349383468baa/src/scripting_api/event.js#L103
so we should do it only if the field passed the validation step.
| Reporter | ||
Comment 5•3 years ago
|
||
(In reply to Calixte Denizet (:calixte) from comment #4)
The pdf is kind of ill-formatted.
The first field contains the value
165.000,00 €which is not a number but a string representing a number with a unit.
Out of curiosity, I modified the flag to make the field modifiable and it isn't really modifiable: each time I press a key nothing is changed because the potential change leads to an invalid number hence the change is cancelled (the only way to modify the field is to select enough chars to just keep a number and then remove them in hitting the delete key).
So the field V entry should just contain165000and the format code should beAFNumber_Format(2, 2, 0, 0, " \u20ac", false);in order to format it correctly (and the AP entry should have the correct appearance).When a pdf is open we run the all the format actions for each field:
https://github.com/mozilla/pdf.js/blob/09da8026b6fd803d60451aaf0aa8349383468baa/src/scripting_api/event.js#L103
so we should do it only if the field passed the validation step.
The field has deliberately been formatted as "Text" by us, which is why I don't understand why the FF PDF Viewer performs any conversions at all on it.
| Reporter | ||
Comment 6•3 years ago
|
||
Hi :calixte, any idea in which release this bug might be resolved? many thanks
Comment 7•2 years ago
|
||
| Assignee | ||
Comment 8•2 years ago
|
||
(In reply to Christoph Kovacs from comment #6)
Hi :calixte, any idea in which release this bug might be resolved? many thanks
Yes, in 115. The patch should be in nightly in the next days.
Updated•2 years ago
|
Description
•