Skip to content

fix(export): scope MathJax PNG rasterization and harden PDF export#2707

Merged
tamlok merged 1 commit into
masterfrom
fix/pdf-export-mathjax-followup
Jul 7, 2026
Merged

fix(export): scope MathJax PNG rasterization and harden PDF export#2707
tamlok merged 1 commit into
masterfrom
fix/pdf-export-mathjax-followup

Conversation

@tamlok

@tamlok tamlok commented Jul 7, 2026

Copy link
Copy Markdown
Member

Follow-up to #2701.

  • Scope convertAllSvgToPng to 'mjx-container svg' so only MathJax output is rasterized. Other inline SVGs (Mermaid/Graphviz/Flowchart/WaveDrom) stay vector and avoid the Mermaid foreignObject canvas taint that made toDataURL() throw and hang the export.
  • Harden the per-equation onload path with try/catch/finally so a single failure always decrements the pending counter and can never strand the pdfRenderReady signal.
  • Preserve on-screen color by inlining computed currentColor; scale the raster by devicePixelRatio (min 2x) for crisper output.
  • Add a bounded 30s wait around pdfRenderReady so a missing callback falls through to printToPdf instead of freezing the export; bind the connection to a context object.
  • Strip accidental UTF-8 BOM from webviewexporter.cpp and exportdialog2.cpp.

Follow-up to #2701.

- Scope convertAllSvgToPng to 'mjx-container svg' so only MathJax output is
  rasterized. Other inline SVGs (Mermaid/Graphviz/Flowchart/WaveDrom) stay
  vector and avoid the Mermaid foreignObject canvas taint that made
  toDataURL() throw and hang the export.
- Harden the per-equation onload path with try/catch/finally so a single
  failure always decrements the pending counter and can never strand the
  pdfRenderReady signal.
- Preserve on-screen color by inlining computed currentColor; scale the raster
  by devicePixelRatio (min 2x) for crisper output.
- Add a bounded 30s wait around pdfRenderReady so a missing callback falls
  through to printToPdf instead of freezing the export; bind the connection to
  a context object.
- Strip accidental UTF-8 BOM from webviewexporter.cpp and exportdialog2.cpp.
@tamlok tamlok temporarily deployed to Mac-code-sign July 7, 2026 03:12 — with GitHub Actions Inactive
@tamlok tamlok merged commit 3eb331a into master Jul 7, 2026
4 checks passed
@tamlok tamlok deleted the fix/pdf-export-mathjax-followup branch July 7, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant