Closed Bug 1659753 Opened 5 months ago Closed 5 months ago

Saving PDF with modifed form data not persisting form data

Categories

(Firefox :: PDF Viewer, defect)

defect

Tracking

()

VERIFIED FIXED
81 Branch
Tracking Status
firefox81 --- verified

People

(Reporter: bdahl, Assigned: bdahl)

References

Details

Attachments

(1 file, 1 obsolete file)

STR:

  1. Open PDF with form e.g. (https://www.irs.gov/pub/irs-pdf/f1040.pdf)
  2. Fill out some form fields
  3. Save the PDF (either ctrl/cmd+s or File->Save Page As)
  4. Close PDF
  5. Open saved file

Expected:
PDF has modified form data
Actual:
PDF form data is empty

I should note that if you click PDF.js's "Download" button the PDF produced works as expected.

Assignee: nobody → bdahl

Now when Ctrl/Cmd+S or "Save Page As" is used, Firefox will send PDF.js a
message to trigger downloading. This allows PDF.js to generate a new PDF
if there is modified form data that needs to be saved or send back the
unmodified data. Once PDF.js has generated the blob it will send messages
to the PdfjsParent to open the "Save As" dialog.

Adds two tests:

  1. Saving a plain PDF without forms.
  2. Saving a PDF with modified forms and verifies the new PDF has the form
    data.

Depends on D87674

Do either of you have thoughts on which behavior we want from the download button in pdf.js (save as or open with)?

More context:
The test browser_download_open_with_internal_handler.js is failing after these changes. It looks like we expect the "open with" dialog to be triggered from the pdf.js download button, where as with these changes the "save as" dialog is opened. IIIRC, the open with dialog was used at the time because there wasn't an easy way to trigger the "save as" dialog. I think the "save as" dialog makes more sense now that we're able to enter form data and save it.

Flags: needinfo?(jaws)
Flags: needinfo?(gijskruitbosch+bugs)

I think the Save As dialog makes more sense here.

Flags: needinfo?(jaws)

I agree that the "save as" dialog makes more sense here. I do want to flag up that some of the flows around opening PDFs in external apps described in the comments in bug 1653807 become harder when we do this, so I wonder if we can come up with a lightweight way of fixing that... still, that doesn't need to happen in this bug.

Flags: needinfo?(gijskruitbosch+bugs)
Attachment #9171084 - Attachment is obsolete: true
Depends on: 1660483
Pushed by bdahl@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c516989687c7
Support saving PDF form data when using "Save Page As". r=Gijs
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch
Regressions: 1660911
No longer regressions: 1660911

Verified with 81.0b4 on Windows 10, macOS 10.15, Ubuntu 18.

Status: RESOLVED → VERIFIED
Blocks: 1659578
You need to log in before you can comment on or make changes to this bug.