mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
47.17k stars 9.82k forks source link

Fields not rendered after saving and opening Dutch tax form #18072

Open timvandermeij opened 1 month ago

timvandermeij commented 1 month ago

Attach (recommended) or Link to PDF file here:

Configuration:

Steps to reproduce the problem:

  1. Open the PDF file (Dutch tax form).
  2. Click the first radio button on the second page. Notice that extra fields appear behind it.
  3. Enter a date: 12-05-2024
  4. Save the PDF file to disk.
  5. Open the saved PDF file. Notice that the first radio button on the second page is checked, but the extra fields behind it are no longer visible. This makes it seem as if data loss occurred, even though that's not the case.
  6. Click the second radio button below it and click the first radio button again. Notice that the extra fields behind the first radio button are now correctly visible, including the entered date.

What is the expected behavior? (add screenshot) Expected

What went wrong? (add screenshot) Actual

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension): https://mozilla.github.io/pdf.js/web/viewer.html

calixteman commented 1 month ago

I suppose the action under the A entry must be triggered even when there's no user action. In the specs, we can read that:

The optional A entry in the annotation or outline item dictionary (see Tables 168 and 153) specifies an
action performed when the annotation or outline item is activated;...

I wonder when we should trigger the action: either when rendering the annotation for the first time or when all the annotations data are loaded in the sandbox (and before or after DcumentOpen/PageOpen...).

timvandermeij commented 1 month ago

Today I found out that if I save the form with the PDF editor in Microsoft Edge and then open the PDF file with Firefox that it does render correctly, so that makes me think that the rendering part in PDF.js might work correctly but that it's rather a problem with saving the PDF file from PDF.js...