Skip to content

Use platform print-to-PDF for FreeText appearances (bug 1794809) - #21858

Open
calixteman wants to merge 1 commit into
mozilla:masterfrom
calixteman:print_pdf_freetext
Open

Use platform print-to-PDF for FreeText appearances (bug 1794809)#21858
calixteman wants to merge 1 commit into
mozilla:masterfrom
calixteman:print_pdf_freetext

Conversation

@calixteman

Copy link
Copy Markdown
Contributor

PDF.js creates FreeText appearances with Helvetica and WinAnsiEncoding. It cannot generate a matching appearance when Helvetica cannot encode the text.

Add a Firefox-only printToPDF callback to saveDocument. The worker batches serialized FreeText entries and imports one generated PDF page per appearance. The single-PDF batch preserves resources shared across pages.

Copy each page's resources and content without reserializing retained operators. Drop marked-content operators because their metadata belongs to the generated PDF.

@codecov-commenter

codecov-commenter commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.56716% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.20%. Comparing base (4c60257) to head (c3c21fa).

Files with missing lines Patch % Lines
src/core/editor/print_appearances.js 87.35% 11 Missing ⚠️
src/core/annotation.js 78.94% 4 Missing ⚠️
src/core/worker.js 84.21% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21858      +/-   ##
==========================================
- Coverage   90.26%   90.20%   -0.07%     
==========================================
  Files         264      265       +1     
  Lines       67287    67414     +127     
==========================================
+ Hits        60739    60809      +70     
- Misses       6548     6605      +57     
Flag Coverage Δ
browsertest 66.28% <28.88%> (-0.02%) ⬇️
fonttest 8.94% <ø> (ø)
integrationtest 69.30% <21.27%> (-0.11%) ⬇️
unittest 58.63% <86.36%> (+0.06%) ⬆️
unittestcli 57.18% <86.36%> (+0.06%) ⬆️

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.

Comment thread src/core/worker.js
Comment thread src/core/worker.js
PDF.js creates FreeText appearances with Helvetica and WinAnsiEncoding. It
cannot generate a matching appearance when Helvetica cannot encode the text.

Add a Firefox-only `printToPDF` callback to `saveDocument`. The worker batches
serialized FreeText entries and imports one generated PDF page per appearance.
The single-PDF batch preserves resources shared across pages.

Copy each page's resources and content without reserializing retained
operators. Drop marked-content operators because their metadata belongs to the
generated PDF.
@calixteman

Copy link
Copy Markdown
Contributor Author

/botio browsertest

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_browsertest from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/7717739676a8b52/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

Command cmd_browsertest from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/058aff0e55f02cc/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/7717739676a8b52/output.txt

Total script time: 19.04 mins

  • Regression tests: Passed

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/058aff0e55f02cc/output.txt

Total script time: 24.20 mins

  • Regression tests: Passed

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.

5 participants