Skip to content

[api-minor] Support form field flattening in saveDocument (bug 2075337) - #22446

Open
calixteman wants to merge 2 commits into
mozilla:masterfrom
calixteman:flatten-forms
Open

calixteman wants to merge 2 commits into
mozilla:masterfrom
calixteman:flatten-forms

Conversation

@calixteman

Copy link
Copy Markdown
Contributor

With flatten: true, also draw the widgets, generating their appearances from the stored values, and remove the ones hidden for the intent.
Prune the removed fields from the AcroForm, and remove it when no page widget remains, unless it declares signatures.
Add a "non-forms" value to keep the form fields.

sync-pdfs-for-pdf-js Bot pushed a commit to mozilla/pdf.js.refs that referenced this pull request Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Viewer preview

Commit 44adeff (build logs).

Viewer Build Preview
Modern (gulp generic) βœ… viewer.html
Legacy (gulp generic-legacy) βœ… viewer.html

Previews are removed when the PR closes and may be pruned after 30 days without an update.

@codspeed

codspeed Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 12.76%

⚑ 2 improved benchmarks
βœ… 86 untouched benchmarks
⏩ 174 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚑ getUnicodeRangeFor (bug1473809.pdf) 25.9 ms 22.9 ms +13.12%
⚑ Autolinker.processLinks: 2 links in each of 5000 text items 79.5 ms 70.7 ms +12.39%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing calixteman:flatten-forms (44adeff) with master (b600aec)

Open in CodSpeed

Footnotes

  1. 174 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@codecov-commenter

codecov-commenter commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.17706% with 19 lines in your changes missing coverage. Please review.
βœ… Project coverage is 90.62%. Comparing base (b600aec) to head (44adeff).

Files with missing lines Patch % Lines
src/core/flattener.js 96.09% 16 Missing ⚠️
src/core/worker.js 85.71% 2 Missing ⚠️
src/core/core_utils.js 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #22446      +/-   ##
==========================================
+ Coverage   90.58%   90.62%   +0.03%     
==========================================
  Files         276      277       +1     
  Lines       68671    69138     +467     
==========================================
+ Hits        62203    62653     +450     
- Misses       6468     6485      +17     
Flag Coverage Ξ”
fonttest 9.09% <0.00%> (-0.01%) ⬇️
integrationtest 69.21% <5.63%> (-0.47%) ⬇️
unittest 64.02% <96.17%> (+0.92%) ⬆️
unittestcli 61.64% <96.17%> (+0.97%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

β˜” View full report in Codecov by Harness.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Add flatten and intent options to draw supported annotation appearances
into page content. Use print or display visibility. Keep the widgets and
the interactive annotations.

Android 14's PdfRenderer calls PDFium without FPDF_ANNOT [1].

[1] https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/libs/hwui/jni/pdf/PdfRenderer.cpp
With `flatten: true`, also draw the widgets, generating their appearances
from the stored values, and remove the ones hidden for the intent. Prune
the removed fields from the AcroForm, and remove it when no page widget
remains, unless it declares signatures. Add a "non-forms" value to keep the
form fields.
sync-pdfs-for-pdf-js Bot pushed a commit to mozilla/pdf.js.refs that referenced this pull request Nov 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants