Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Revert "Further pdf export improvements" (#71208)

Fraser4864f0ae246f
diff --git a/patches/html2canvas-pro+2.0.2.patch b/patches/html2canvas-pro+2.0.2.patch
index 2e5393bd0c2..b0c0484456e 100644
--- a/patches/html2canvas-pro+2.0.2.patch
+++ b/patches/html2canvas-pro+2.0.2.patch
@@ -1,5 +1,5 @@
diff --git a/node_modules/html2canvas-pro/dist/html2canvas-pro.esm.js b/node_modules/html2canvas-pro/dist/html2canvas-pro.esm.js
-index d49f1bd..77be9b6 100644
+index d49f1bd..1387285 100644
--- a/node_modules/html2canvas-pro/dist/html2canvas-pro.esm.js
+++ b/node_modules/html2canvas-pro/dist/html2canvas-pro.esm.js
@@ -5875,6 +5875,8 @@ class SVGElementContainer extends ElementContainer {
@@ -11,53 +11,7 @@ index d49f1bd..77be9b6 100644
const bounds = parseBounds(context, img);
img.setAttribute('width', `${bounds.width}px`);
img.setAttribute('height', `${bounds.height}px`);
-@@ -7144,13 +7146,39 @@ const ignoredStyleProperties = [
- 'd', // #2483
- 'content' // Safari shows pseudoelements if content is set
- ];
-+const svgTextFontProperties = [
-+ 'font-family',
-+ 'font-size',
-+ 'font-weight',
-+ 'font-style',
-+ 'font-variant',
-+ 'font-stretch',
-+ 'font-size-adjust',
-+ 'letter-spacing',
-+ 'word-spacing',
-+ 'line-height',
-+];
-+const isSVGTextNode = (node) => {
-+ const tagName = node.tagName;
-+ return tagName === 'text' || tagName === 'tspan' || tagName === 'textPath';
-+};
- const copyCSSStyles = (style, target) => {
-- // Edge does not provide value for cssText
-- for (let i = style.length - 1; i >= 0; i--) {
-- const property = style.item(i);
-- // fix: Chrome_138 ignore custom properties
-- if (ignoredStyleProperties.indexOf(property) === -1 && !property.startsWith('--')) {
-- target.style.setProperty(property, style.getPropertyValue(property));
-+ // Use cssText for a single native call instead of iterating 300+ properties
-+ // individually via style.item(i), which is extremely slow in Firefox due to
-+ // Stylo's per-call indexmap lookups in the custom properties map.
-+ target.style.cssText = style.cssText;
-+ // Remove properties that should be ignored
-+ for (let i = ignoredStyleProperties.length - 1; i >= 0; i--) {
-+ target.style.removeProperty(ignoredStyleProperties[i]);
-+ }
-+ // For SVG text elements, explicitly re-apply font properties from the
-+ // computed style since cssText may not reliably serialize them.
-+ if (isSVGTextNode(target)) {
-+ for (let i = 0; i < svgTextFontProperties.length; i++) {
-+ const value = style.getPropertyValue(svgTextFontProperties[i]);
-+ if (value) {
-+ target.style.setProperty(svgTextFontProperties[i], value);
-+ }
- }
- }
- return target;
-@@ -7534,7 +7562,8 @@ class ElementPaint {
+@@ -7534,7 +7536,8 @@ class ElementPaint {
const rotateMatrix = [cos, sin, -sin, cos, 0, 0];
this.effects.push(new TransformEffect(offsetX, offsetY, rotateMatrix));
}
@@ -67,7 +21,7 @@ index d49f1bd..77be9b6 100644
const origin = this.container.styles.transformOrigin;
const offsetX = this.container.bounds.left + getAbsoluteValue(origin[0], this.container.bounds.width);
const offsetY = this.container.bounds.top + getAbsoluteValue(origin[1], this.container.bounds.height);
-@@ -10373,12 +10402,12 @@ class Validator {
+@@ -10373,12 +10376,12 @@ class Validator {
}
// Basic format validation - nonce should be base64-like
// Typical format: base64 string, often 32+ characters