Disabled form fields in PDFs do not contain pre-filled values (values not visible / shown )
Categories
(Firefox :: PDF Viewer, defect, P1)
Tracking
()
People
(Reporter: Gijs, Assigned: calixte)
References
(Regression)
Details
(Keywords: regression)
Attachments
(3 files)
(These steps require an account with ADP in the UK.)
STR:
- Log in to the ADP website
- Open the P11D form (linked on the right hand side)
- Scroll down to section
I
(second page) - try to read the medical insurance values
ER:
The value of medical insurance given in the PDF is shown
AR:
No value is shown.
Opening the PDF in preview.app, the values show up fine.
Inspecting the PDF.js-generated HTML DOM in Firefox, there is no trace of the values shown in preview (ie the input
elements are just empty). Removing the inputs doesn't show otherwise occluded text, either, and trying to search for the relevant values in the DOM inspector yields no hits. I don't know where the discrepancy comes from.
Comment 1•4 years ago
|
||
(In reply to :Gijs (he/him) from comment #0)
(These steps require an account with ADP in the UK.)
And it requires your employer to have sent you a P11D form.
Could you alter the form values to remove your personal information and upload the form here?
Reporter | ||
Comment 2•4 years ago
|
||
(In reply to Marco Castelluccio [:marco] from comment #1)
(In reply to :Gijs (he/him) from comment #0)
(These steps require an account with ADP in the UK.)
And it requires your employer to have sent you a P11D form.
Could you alter the form values to remove your personal information and upload the form here?
None of the form values are editable.
Comment 3•4 years ago
|
||
You could use a PDF editor, like LibreOffice Draw.
Reporter | ||
Comment 4•4 years ago
|
||
(In reply to Marco Castelluccio [:marco] from comment #3)
You could use a PDF editor, like LibreOffice Draw.
To do this I copied the PDF to a Linux VM where LibreOffice Draw was already installed. This made me notice that the original PDF does not show the relevant text on macOS, nor on Windows, but it shows text on Linux (all in Firefox's PDF.js, for the exact same PDF file - I even checked the sha256 after moving the file through vmware because I was very confused).
If I open the PDF in LibreOffice Draw and export a PDF, the text shows up everywhere (and lots of other bits of the PDF are lost / misaligned) - I don't think it manipulates the PDF in-place, it just re-exports a new PDF, which doesn't have the original problem. If I "Save as" it tries to save a LibreOffice Draw file.
I don't really mind the exact figures on the PDF, so I tried cutting out the first page (which has much more privacy-sensitive data; the second page only has the buggy bit, basically) in Preview.app on my mac, but that too re-encodes the PDF and gets rid of the problem...
Do you have any suggestions on how to debug this further? If there is something that can sort of show me the "markup" of the PDF so I can manually delete the first page, that'd probably do the trick...
Reporter | ||
Comment 5•4 years ago
|
||
Turns out this is a regression, and I was seeing the correct behaviour on Linux because I was using an old (88) distro build and I was using newer builds on Windows/macOS.
Updated•4 years ago
|
Reporter | ||
Comment 6•4 years ago
|
||
In the builds that work, the form field's input
gets a value
attribute with the correct value.
I've also noticed something else weird. When the PDF that is broken is saved to my local disk on Windows, when I open the file in a new blank tab on a buggy build, the text does not show up. If I then hit reload, I get a beforeunload prompt ("This page is asking you to confirm that you want to leave"). If I accept, the pdf reloads and then the text does show up. If I reload again, I don't get a beforeunload prompt, and the text stays. If I close the tab, open a new tab, paste the same file:
URL back in and load the PDF anew, the text is missing again.
It feels like there's some kind of race condition in PDF.js relating to the display of these values...
Assignee | ||
Comment 7•4 years ago
|
||
:Gijs, can you send me the pdf by mail ?
If not, you can use something like qpdf --stream-data=uncrompress your.pdf newone.pdf
to uncompress all the streams in the pdf.
Then you can open the new one using a text editor, if it's readable, you can replace private data with some XXX (use the same number of chars to avoid some wrong positions for the objects in the pdf) and then finally you can attach the pdf here (or send it to me).
You can "cut" the pdf in using pdftk your.pdf cat 1-3 output newone.pdf
to just extract pages 1,2 and 3.
Updated•4 years ago
|
Reporter | ||
Comment 8•4 years ago
|
||
Will take a look at the suggestions in comment #7 ASAP - thanks!
Comment 9•4 years ago
|
||
Set release status flags based on info from the regressing bug 1702796
Updated•4 years ago
|
Updated•4 years ago
|
Reporter | ||
Comment 10•4 years ago
|
||
OK, I've emailed you the PDF. I did try to remove personal data so I could share it publicly, but even the uncompressed PDF is obfuscated enough (in some cases encoding info 1 character at a time) that it's difficult to ensure there's nothing left...
Updated•4 years ago
|
Updated•4 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 11•3 years ago
|
||
JS sets the text field as readonly and consequently the annotationStorage
is containing { readonly: true }
for this annotation.
And we get the value for this annotation:
https://github.com/mozilla/pdf.js/blob/7082ff9bf876b98fbda118cdbd6267d3c0df6948/src/display/annotation_layer.js#L707
but the default value (2nd argument) is not used because the storage contains something for this annotation.
So because of:
https://github.com/mozilla/pdf.js/blob/7082ff9bf876b98fbda118cdbd6267d3c0df6948/src/display/annotation_layer.js#L711
the content is an empty string.
The fix is just to add the default value which are not in the storage to the returned value.
For information I cannot reproduce this bug using pdf.js with a local server, likely because in the built-in viewer the JS stuff is executed before the annotation layer is rendered, I wonder if it matters...
Comment 12•3 years ago
|
||
Comment 13•3 years ago
|
||
Updated•3 years ago
|
Comment 14•3 years ago
|
||
:Gijs, could you verify this is fixed for you?
Reporter | ||
Comment 15•3 years ago
|
||
Yes, it works now! 😁🎉
Reporter | ||
Updated•3 years ago
|
Description
•