diff --git a/src/Mpdf.php b/src/Mpdf.php
index 4ab0d0f7d..4641a9fec 100644
--- a/src/Mpdf.php
+++ b/src/Mpdf.php
@@ -27195,7 +27195,8 @@ function AdjustHTML($html, $tabSpaces = 8)
if (count($svgi[0])) {
for ($i = 0; $i < count($svgi[0]); $i++) {
$file = $this->cache->write('/_tempSVG' . uniqid(random_int(1, 100000), true) . '_' . $i . '.svg', $svgi[0][$i]);
- $html = str_replace($svgi[0][$i], '', $html);
+ $class = $this->svgClassAttribute($svgi[0][$i]);
+ $html = str_replace($svgi[0][$i], '', $html);
}
}
@@ -27341,6 +27342,28 @@ function AdjustHTML($html, $tabSpaces = 8)
return $html;
}
+ /**
+ * The class an embedded SVG was given, so the img element it becomes can still be reached by the
+ * selectors written for it. The value may be double quoted, single quoted or unquoted, as any
+ * attribute value may be; a double quote is dropped because no class name can hold one.
+ *
+ * @param string $svg
+ *
+ * @return string
+ */
+ private function svgClassAttribute($svg)
+ {
+ $matches = [];
+ if (!preg_match('/^