Commit faeb8b0
committed
fix(export): pin MathJax SVG viewport to stop squeezed PDF equations
Follow-up to #2701 and 48e77d3.
Display equations whose MathJax root <svg> is sized in page-relative
units (width="100%", height in ex) and wrap a nested <svg data-table>
(matrices/aligned equations) rendered squeezed in exported PDFs: loaded
as a standalone image the relative units have no containing block and
collapse to a default size.
- Narrow convertAllSvgToPng's selector to 'mjx-container > svg' so only
each equation's root svg is rasterized; the nested inner svg is
captured within the root and scales to fill its pinned viewport.
- Measure getBoundingClientRect() first, then serialize a detached clone
with width/height pinned to the measured CSS pixels (the export body is
sized to the print page), recreating the exact on-page viewport. The
live DOM is left untouched until replaceChild.1 parent 3eb331a commit faeb8b0
1 file changed
Lines changed: 26 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
186 | 191 | | |
187 | 192 | | |
188 | 193 | | |
| |||
202 | 207 | | |
203 | 208 | | |
204 | 209 | | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
210 | 213 | | |
211 | 214 | | |
212 | 215 | | |
213 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
214 | 234 | | |
215 | 235 | | |
216 | 236 | | |
| |||
0 commit comments