Closed Bug 1825002 Opened 3 years ago Closed 2 years ago

PDF form field displayed as number instead of text

Categories

(Firefox :: PDF Viewer, defect, P3)

Firefox 111
defect

Tracking

()

RESOLVED FIXED
115 Branch

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

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.

Component: Untriaged → PDF Viewer

:Christoph Kovacs, could you attach the pdf to this bug please ?

Flags: needinfo?(christoph.kovacs)

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"

Flags: needinfo?(christoph.kovacs)
Assignee: nobody → cdenizet
Severity: -- → S3
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P3

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.

(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 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.

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.

Hi :calixte, any idea in which release this bug might be resolved? many thanks

Flags: needinfo?(cdenizet)

(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.

Flags: needinfo?(cdenizet)
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: